<?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>alexyz</title>
	<atom:link href="http://alexyz.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexyz.com</link>
	<description>developer notes</description>
	<lastBuildDate>Thu, 15 Mar 2012 22:48:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress Functions.php add_filter after comment redirect</title>
		<link>http://alexyz.com/wordpress-functions-php-add_filter-after-comment-redirect/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-functions-php-add_filter-after-comment-redirect</link>
		<comments>http://alexyz.com/wordpress-functions-php-add_filter-after-comment-redirect/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 22:47:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1430</guid>
		<description><![CDATA[add_filter(&#8216;comment_post_redirect&#8216;, &#8216;redirect_after_comment&#8216;); function redirect_after_comment() { wp_redirect($_SERVER['HTTP_REFERER']); }]]></description>
			<content:encoded><![CDATA[<p>add_filter(&#8216;<span style="color: #ff0000;">comment_post_redirect</span>&#8216;, &#8216;<span style="color: #ff0000;">redirect_after_comment</span>&#8216;);<br />
function <span style="color: #ff0000;">redirect_after_comment</span>()<br />
{<br />
wp_redirect(<span style="color: #0000ff;">$_SERVER</span>['<span style="color: #800000;">HTTP_REFERER</span>']);<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-functions-php-add_filter-after-comment-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql Command Line Import</title>
		<link>http://alexyz.com/mysql-command-line-import/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-command-line-import</link>
		<comments>http://alexyz.com/mysql-command-line-import/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 19:34:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1424</guid>
		<description><![CDATA[navigate to the folder containing the .sql file you&#8217;d like to import &#62;mysql -user -password databaseToImportInto &#60; newData.sql return &#8211; no ; (unless you are IN mysql&#62;) password: example: &#62;mysql -root -p someDB&#60;newData.sql (return) password: (return &#8211; default config has none, unless you&#8217;ve, hopefully, changed it, then enter it)]]></description>
			<content:encoded><![CDATA[<p>navigate to the folder containing the .sql file you&#8217;d like to import</p>
<p>&gt;mysql -user -password databaseToImportInto &lt; newData.sql</p>
<p>return &#8211; no ; (unless you are IN mysql&gt;)</p>
<p>password:</p>
<p>example:</p>
<p>&gt;mysql -root -p someDB&lt;newData.sql (return)</p>
<p>password: (return &#8211; default config has none, unless you&#8217;ve, hopefully, changed it, then enter it)</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-command-line-import/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MYSQL Query clear all data in a column</title>
		<link>http://alexyz.com/mysql-query-clear-all-data-in-a-column/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-query-clear-all-data-in-a-column</link>
		<comments>http://alexyz.com/mysql-query-clear-all-data-in-a-column/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 19:09:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[all]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[erase]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1420</guid>
		<description><![CDATA[UPDATE table SET column = &#8221; example: UPDATE wp_posts SET post_excerpt = &#8221;]]></description>
			<content:encoded><![CDATA[<p>UPDATE <strong>table</strong> SET <strong>column</strong> = &#8221;</p>
<p>example:</p>
<p>UPDATE <strong>wp_posts</strong> SET <strong>post_excerpt</strong> = &#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-query-clear-all-data-in-a-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery .hover change div background-position example</title>
		<link>http://alexyz.com/jquery-hover-change-div-background-position-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-hover-change-div-background-position-example</link>
		<comments>http://alexyz.com/jquery-hover-change-div-background-position-example/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 23:48:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1416</guid>
		<description><![CDATA[example for reference: $(&#8220;#formButtonSubmit&#8220;).hover(function(){ $(this).css({ backgroundPosition: &#8217;0px 0px&#8217; }); }, function(){ $(this).css({ backgroundPosition: &#8217;0px 30px&#8217; }); });]]></description>
			<content:encoded><![CDATA[<p>example for reference:</p>
<p><span style="color: #0000ff;">$</span>(&#8220;#<span style="color: #ff0000;">formButtonSubmit</span>&#8220;).<span style="color: #0000ff;">hover</span>(<span style="color: #008000;">function()</span>{<br />
<span style="color: #0000ff;">$</span>(<strong>this</strong>).<span style="color: #0000ff;">css</span>({<br />
backgroundPosition: &#8217;0px 0px&#8217;<br />
});<br />
}, function(){<br />
<span style="color: #0000ff;">$</span>(<strong>this</strong>).<span style="color: #0000ff;">css</span>({<br />
backgroundPosition: &#8217;0px 30px&#8217;<br />
});<br />
});</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-hover-change-div-background-position-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP command line accept inputs &#8211; $argv</title>
		<link>http://alexyz.com/php-command-line-accept-input/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-command-line-accept-input</link>
		<comments>http://alexyz.com/php-command-line-accept-input/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 17:51:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1405</guid>
		<description><![CDATA[http://php.net/manual/en/reserved.variables.argv.php example: ~a sudo php scriptname.php 100 pass IN 100 to the script. In the script, receive input: $batchNumber = $argv[1] test it: var_dump($argv); handy when calling a php script via a cron, thus allowing the script parameters to be configurable via the cron.]]></description>
			<content:encoded><![CDATA[<p><a href="http://php.net/manual/en/reserved.variables.argv.php">http://php.net/manual/en/reserved.variables.argv.php</a></p>
<p>example:</p>
<p>~a sudo php scriptname.php <strong>100</strong></p>
<p>pass IN 100 to the script.</p>
<p>In the script, receive input:</p>
<p>$batchNumber = <span style="color: #0000ff;">$argv[1]</span></p>
<p>test it:</p>
<p><code>var_dump(<span style="color: #0000ff;">$argv</span>);</code></p>
<p>handy when calling a php script via a cron, thus allowing the script parameters to be configurable via the cron.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-command-line-accept-input/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP $_Server Host Name etc. command line equivalent</title>
		<link>http://alexyz.com/php-_server-host-name-etc-command-line-equivalent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-_server-host-name-etc-command-line-equivalent</link>
		<comments>http://alexyz.com/php-_server-host-name-etc-command-line-equivalent/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 17:49:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1403</guid>
		<description><![CDATA[http://php.net/manual/en/function.php-uname.php string php_uname ([ string $mode = "a" ] ) mode is a single character that defines what information is returned: &#8216;a&#8217;: This is the default. Contains all modes in the sequence &#8220;s n r v m&#8221;. &#8216;s&#8217;: Operating system name. eg. FreeBSD. &#8216;n&#8217;: Host name. eg. localhost.example.com. &#8216;r&#8217;: Release name. eg. 5.1.2-RELEASE. &#8216;v&#8217;: Version [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://php.net/manual/en/function.php-uname.php">http://php.net/manual/en/function.php-uname.php</a></p>
<div>string <strong>php_uname</strong> ([ string <tt>$mode</tt> = "a"   ] )</div>
<dl>
<dd><em><tt>mode</tt></em> is a single character that defines what        information is returned:</p>
<ul>
<li> <em>&#8216;a&#8217;</em>: This is the default. Contains all modes in           the sequence <em>&#8220;s n r v m&#8221;</em>.</li>
<li> <em>&#8216;s&#8217;</em>: Operating system name. eg.            <em>FreeBSD</em>.</li>
<li> <em>&#8216;n&#8217;</em>: Host name. eg.            <em>localhost.example.com</em>.</li>
<li> <em>&#8216;r&#8217;</em>: Release name. eg.            <em>5.1.2-RELEASE</em>.</li>
<li> <em>&#8216;v&#8217;</em>: Version information. Varies a lot between           operating systems.</li>
<li> <em>&#8216;m&#8217;</em>: Machine type. eg. <em>i386</em>.</li>
</ul>
</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-_server-host-name-etc-command-line-equivalent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure HTML form example using PHP htmlentities, passing a token PHP, AJAX submission via jQuery</title>
		<link>http://alexyz.com/secure-html-form-example-using-php-htmlentities-passing-a-token-php-ajax-submission-via-jquery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=secure-html-form-example-using-php-htmlentities-passing-a-token-php-ajax-submission-via-jquery</link>
		<comments>http://alexyz.com/secure-html-form-example-using-php-htmlentities-passing-a-token-php-ajax-submission-via-jquery/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 16:55:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1398</guid>
		<description><![CDATA[&#60;? php // form page (index.php): initialize a session so that we can set a unique, random, encrypted value to a user session session_start(); $token = md5(uniqid(rand(), true)); $_SESSION['token'] = $token; ? &#62; &#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#62; &#60;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&#62; &#60;head&#62; &#60;script src=&#8221;js/jquery.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62; &#60;script src=&#8221;js/jquery.validation.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62; &#60;script src=&#8221;js/registerSubmit.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62; &#60;/head&#62; &#60;body&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">&lt;? php</span><br />
<span style="color: #ff0000;">// form page (index.php): initialize a session so that we can set a unique, random, encrypted value to a user session</span><br />
session_start();<br />
$token = md5(uniqid(rand(), true));<br />
$_SESSION['token'] = $token;<br />
<span style="color: #ff0000;">? &gt;</span><br />
&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;script src=&#8221;js/jquery.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;js/jquery.validation.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;js/registerSubmit.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
<span style="color: #ff0000;">&lt;!&#8211; The Form &#8211;&gt;</span><br />
&lt;form id=&#8221;topForm&#8221; name=&#8221;topForm&#8221; method=&#8221;post&#8221;&gt;<br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;token&#8221; id=&#8221;token&#8221; value=&#8221;<span style="color: #ff0000;">&lt;? php</span> echo $token; <span style="color: #ff0000;">? &gt;</span>&#8221; /&gt;<br />
&lt;input name=&#8221;emailAddress&#8221; id=&#8221;emailAddress&#8221; value=&#8221;Email address&#8221; onclick=&#8221;if( this.value == &#8216;Email address&#8217; ){ $(this).val(&#8221;); }&#8221; onblur=&#8221;if( this.value == &#8221;){ $(this).val(&#8216;Email address&#8217;); }&#8221; /&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p><span style="color: #ff0000;">// The jquery.validation.js class uses a regular expression to stop the process if the email entered isn&#8217;t acceptable</span></p>
<p>;(function($) {<br />
$.validation = {};<br />
$.extend( $.validation, {<br />
email:function(email) {<br />
var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;<br />
if ( filter.test(email) ) {<br />
return true;<br />
}<br />
return false;<br />
}<br />
});<br />
})(jQuery);</p>
<p><span style="color: #ff0000;">// The registerSubmit.js submits the entered email via AJAX, returning a success or failure message, to our contactSubmit.php script, which handles the submission of the new email to a database</span></p>
<p>$(document).ready(function() {</p>
<p>$(&#8220;#reg-button&#8221;).click(function(){<br />
$(&#8220;#topForm&#8221;).submit();<br />
});</p>
<p>$(&#8220;#topForm&#8221;).submit(function(event) {<br />
event.preventDefault();<br />
var $form = $( this ),<br />
emailAddress = $form.find( &#8216;input[name="emailAddress"]&#8216; ).val(),<br />
token = $form.find( &#8216;input[name="token"]&#8216; ).val(),<br />
formaction = $form.attr( &#8216;action&#8217; );</p>
<p>if($.validation.email(emailAddress)){<br />
$( &#8220;#reg-description&#8221; ).html (&#8220;submitting&#8230;&#8221;);<br />
$.ajax({<br />
type: &#8220;POST&#8221;,<br />
url: &#8220;contactSubmit.php&#8221;,<br />
data: &#8220;firstName=&#8221; + firstName + &#8220;&amp;lastName=&#8221; + lastName + &#8220;&amp;emailAddress=&#8221; + emailAddress + &#8220;&amp;token=&#8221; + token,<br />
success: function(){<br />
$( &#8220;#reg-description&#8221; ).html( &#8220;Thank you. You have been registered.&#8221; );<br />
},<br />
});<br />
}<br />
else{<br />
$( &#8220;#emailAddress&#8221; ).val (&#8220;Please enter a valid email address&#8221;);<br />
}<br />
});<br />
});</p>
<p><span style="color: #ff0000;">// contactSubmit.php:  receive the email, check the token, clean the data, pass to a database layer API</span></p>
<p><span style="color: #ff0000;">&lt;? php</span><br />
session_start();</p>
<p>set_include_path(&#8216;DBlayerClass&#8217;);<br />
require_once(&#8216;EmailContact.php&#8217;);</p>
<p>if (isset($_SESSION['token']) &amp;&amp; $_POST['token'] == $_SESSION['token']){<br />
if(isset($_POST['emailAddress'])){<br />
$emailAddress = htmlentities($_POST['emailAddress']);<br />
} else { $emailAddress = &#8221;; }</p>
<p>$contact = new EmailContact($emailAddress)</p>
<p>try {<br />
$contact-&gt;save();<br />
} catch (Exception $e) {<br />
; // do something<br />
}<br />
//$retrieve = new EmailContact($emailAddress);<br />
//$retrieve-&gt;load();<br />
//print_r($retrieve);<br />
//}<br />
<span style="color: #ff0000;">? &gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/secure-html-form-example-using-php-htmlentities-passing-a-token-php-ajax-submission-via-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP retrieving user input when executing a script from the command line</title>
		<link>http://alexyz.com/php-retrieving-user-input-when-executing-a-script-from-the-command-line/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-retrieving-user-input-when-executing-a-script-from-the-command-line</link>
		<comments>http://alexyz.com/php-retrieving-user-input-when-executing-a-script-from-the-command-line/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 16:15:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1394</guid>
		<description><![CDATA[So either execute the script via the browser, http://someserver/somescript.php or via the command line &#62;php somescript.php the example below shows how to support either eventuality //first we check to see whether the script is being run via the command line, or via a browser if(defined(&#8216;STDIN&#8216;) ){ echo &#8220;Running from CLI&#8221; . PHP_EOL; echo &#8220;How many [...]]]></description>
			<content:encoded><![CDATA[<p>So either execute the script via the browser, http://someserver/somescript.php<br />
or via the command line &gt;php somescript.php<br />
the example below shows how to support either eventuality</p>
<p><span style="color: #ff0000;">//first we check to see whether the script is being run via the command line, or via a browser</span></p>
<p><span style="color: #0000ff;">if</span>(<span style="color: #0000ff;">defined</span>(&#8216;<span style="color: #0000ff;">STDIN</span>&#8216;) ){<br />
<span style="color: #0000ff;">echo</span> &#8220;Running from CLI&#8221; <span style="color: #0000ff;">. PHP_EOL</span>;<br />
<span style="color: #0000ff;">echo</span> &#8220;How many items would you like to batch?&#8221;;<br />
$handle = <span style="color: #0000ff;">fopen</span> (&#8220;php://stdin&#8221;,&#8221;r&#8221;);<br />
$line = <span style="color: #0000ff;">fgets</span>($handle);<br />
$batchNumber = <span style="color: #0000ff;">trim</span>($line);<br />
<span style="color: #ff0000;">// and so on&#8230;</span><br />
}<span style="color: #0000ff;">else</span>{<br />
<span style="color: #0000ff;">echo</span> &#8220;Running from the Browser&lt;br /&gt;&#8221;;<br />
<span style="color: #ff0000;">// and so on&#8230;</span><br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-retrieving-user-input-when-executing-a-script-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Post via jQuery across domains (in this case to a Zend Controller and subsequent view) and display the results</title>
		<link>http://alexyz.com/post-via-jquery-across-domains-in-this-case-to-a-zend-controller-and-subsequent-view-and-display-the-results/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=post-via-jquery-across-domains-in-this-case-to-a-zend-controller-and-subsequent-view-and-display-the-results</link>
		<comments>http://alexyz.com/post-via-jquery-across-domains-in-this-case-to-a-zend-controller-and-subsequent-view-and-display-the-results/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 23:09:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1392</guid>
		<description><![CDATA[the jQuery posting page, in brief: &#60;document&#8230;&#62; &#60;head&#62; &#60;script src=&#8221;http://code.jquery.com/jquery-1.5.js&#8221;&#62;&#60;/script&#62; &#60;/head&#62; &#60;body&#62; &#60;form id=&#8221;enewsform&#8221; name=&#8221;enewsform&#8221; action=&#8221;http://componentserver/controllername/post&#8221; method=&#8221;post&#8221;&#62; &#60;input type=&#8221;text&#8221; name=&#8221;email&#8221; id=&#8221;email&#8221; value=&#8221;&#60;?php echo $_REQUEST['email']; ?&#62;&#8221; /&#62; &#60;a id=&#8221;submitsubscribe&#8221; title=&#8221;Subscribe&#8221; href=&#8221;javascript:{}&#8221; onclick=&#8221;return false;&#8221;&#62;sign up&#60;/a&#62; &#60;/form&#62; &#60;script src=&#8221;http://components.someserver.com/js/jquery.validation.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62; &#60;script&#62; $(&#8216;#submitsubscribe&#8217;).click(function(){ $(&#8220;#enewsform&#8221;).submit(); }); $(&#8220;#enewsform&#8221;).submit(function(event) { event.preventDefault(); $( &#8220;#result&#8221; ).html (&#8220;submitting&#8230;&#8221;); var $form = $( this ), term [...]]]></description>
			<content:encoded><![CDATA[<p>the jQuery posting page, in brief:</p>
<p>&lt;document&#8230;&gt;<br />
&lt;<span style="color: #008000;">head</span>&gt;<br />
<span style="color: #0000ff;">&lt;script src=&#8221;http://code.jquery.com/jquery-1.5.js&#8221;&gt;&lt;/script&gt;</span><br />
&lt;<span style="color: #008000;">/head</span>&gt;<br />
&lt;<span style="color: #008000;">body</span>&gt;<br />
&lt;<span style="color: #008000;">form</span> id=&#8221;enewsform&#8221; name=&#8221;enewsform&#8221; action=&#8221;http://componentserver/controllername/post&#8221; method=&#8221;post&#8221;&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;email&#8221; id=&#8221;email&#8221; value=&#8221;&lt;?php echo $_REQUEST['email']; ?&gt;&#8221; /&gt;<br />
&lt;a id=&#8221;submitsubscribe&#8221; title=&#8221;Subscribe&#8221; href=&#8221;javascript:{}&#8221; onclick=&#8221;return false;&#8221;&gt;sign up&lt;/a&gt;<br />
&lt;/form&gt;<br />
<span style="color: #0000ff;">&lt;script src=&#8221;http://components.someserver.com/js/jquery.validation.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;</span><br />
<span style="color: #0000ff;">&lt;script&gt;</span><br />
$(&#8216;#submitsubscribe&#8217;).click(function(){<br />
$(&#8220;#enewsform&#8221;).submit();<br />
});</p>
<p>$(&#8220;#enewsform&#8221;).submit(function(event) {<br />
event.preventDefault();<br />
$( &#8220;#result&#8221; ).html (&#8220;submitting&#8230;&#8221;);<br />
var $form = $( this ),<br />
term = $form.find( &#8216;input[name="email"]&#8216; ).val(),<br />
url = $form.attr( &#8216;action&#8217; );</p>
<p>if($.validation.email(term)){<br />
$.getJSON(url + &#8220;?email=&#8221; + term + &#8220;&amp;jsoncallback=?&#8221;, function(data){<br />
$( &#8220;#result&#8221; ).html( data['error'] );<br />
if(data['error']== &#8220;errormatchingstring&#8221;){<br />
$( &#8220;#result&#8221; ).html( &#8220;Seems like it worked&#8221; );<br />
}else{ $( &#8220;#result&#8221; ).html(data['error']); }<br />
});<br />
}<br />
else{ $( &#8220;#result&#8221; ).html (&#8220;Please enter your email address&#8221;); }</p>
<p>});<br />
<span style="color: #0000ff;">&lt;/script&gt;</span></p>
<p>&lt;<span style="color: #008000;">div</span> id=&#8221;result&#8221;&gt;&lt;/<span style="color: #008000;">div</span>&gt;</p>
<p><span style="color: #ff0000;">// the component Zend controller in question receives the post, does whatever it does, renders its view, and we access the results from the view (don&#8217;t forget to pass data to the view with something like this:</span><br />
<span style="color: #0000ff;">$this-&gt; view-&gt; viewresult = $this-&gt; viewData;</span>)</p>
<p><span style="color: #ff0000;">&lt;? php </span><br />
<span style="color: #008000;">echo</span> $_REQUEST['jsoncallback'] . &#8216;(&#8216; . json_encode($this-&gt; viewresult) . &#8216;)&#8217;;<br />
<span style="color: #ff0000;">? &gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/post-via-jquery-across-domains-in-this-case-to-a-zend-controller-and-subsequent-view-and-display-the-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bronto API PHP Class to Send a Contact a particular Message (Zend Helper)</title>
		<link>http://alexyz.com/bronto-class-to-send-a-contact-a-particular-message-zend-helper/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bronto-class-to-send-a-contact-a-particular-message-zend-helper</link>
		<comments>http://alexyz.com/bronto-class-to-send-a-contact-a-particular-message-zend-helper/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 22:36:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bronto]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1388</guid>
		<description><![CDATA[&#60; ? php class Zend_Controller_Action_Helper_BrontoSendMessage extends Zend_Controller_Action_Helper_Abstract { public $message; public $client; public $viewData; public $list; public $now = &#8220;date(&#8216;c&#8217;)&#8221;; public $recipientObject; public $email; public $contact; public $contactId; private $fromName = &#8216;WHATEVERYOUWOULDLIKE&#8217;; private $fromEmail = &#8216;YOU@YOURMAIL.COM&#8217;; public function login(){ ini_set(&#8220;soap.wsdl_cache_enabled&#8221;, &#8220;0&#8243;); date_default_timezone_set(&#8216;America/New_York&#8217;); $wsdl = &#8220;https://api.bronto.com/v4?wsdl&#8221;; $url = &#8220;https://api.bronto.com/v4&#8243;; $this-&#62; client = new SoapClient($wsdl, array(&#8216;trace&#8217; =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;"><span style="color: #ff0000;">&lt; ? php</span><br />
class</span> <span style="color: #008000;">Zend_Controller_Action_Helper</span>_BrontoSendMessage extends <span style="color: #008000;">Zend_Controller_Action_Helper_Abstract</span> {</p>
<p>public $message;<br />
public $client;<br />
public $viewData;<br />
public $list;<br />
public $now = &#8220;date(&#8216;c&#8217;)&#8221;;<br />
public $recipientObject;<br />
public $email;<br />
public $contact;<br />
public $contactId;</p>
<p>private $fromName = &#8216;WHATEVERYOUWOULDLIKE&#8217;;<br />
private $fromEmail = &#8216;YOU@YOURMAIL.COM&#8217;;</p>
<p><span style="color: #800000;">public function login()</span>{<br />
ini_set(&#8220;soap.wsdl_cache_enabled&#8221;, &#8220;0&#8243;);<br />
date_default_timezone_set(&#8216;America/New_York&#8217;);</p>
<p>$wsdl = &#8220;https://api.bronto.com/v4?wsdl&#8221;;<br />
$url = &#8220;https://api.bronto.com/v4&#8243;;</p>
<p>$this-&gt; client = <span style="color: #0000ff;">new</span> SoapClient($wsdl, array(&#8216;trace&#8217; =&gt; 1, &#8216;encoding&#8217; =&gt; &#8216;UTF-8&#8242;));<br />
$this-&gt; client-&gt;__setLocation($url);</p>
<p><span style="color: #ff0000;">// Login</span><br />
$token = &#8220;YOUR BRONTO TOKEN HERE&#8221;;<br />
$sessionId = $this-&gt; client-&gt;login(array(&#8220;apiToken&#8221; =&gt; $token))-&gt;return;<br />
if (!$sessionId) {<br />
<span style="color: #008000;">return</span> &#8220;Login failed&#8221;;<br />
}<br />
$this-&gt; client-&gt;__setSoapHeaders(array(<span style="color: #0000ff;">new</span> SoapHeader(&#8220;http://api.bronto.com/v4&#8243;,<br />
&#8216;sessionHeader&#8217;,<br />
array(&#8216;sessionId&#8217; =&gt; $sessionId))));</p>
<p>$this-&gt; viewData['login'] = &#8220;logged in&#8221;;<br />
}</p>
<p><span style="color: #800000;">public function setContact</span>($email){<br />
$this-&gt; email = $email;</p>
<p>$filter = array(&#8216;email&#8217; =&gt; array(array(&#8216;operator&#8217; =&gt; &#8216;EqualTo&#8217;,'value&#8217; =&gt; $this-&gt; email)));</p>
<p>$this-&gt; contact = $this-&gt; client-&gt;<span style="color: #008000;">readContacts</span>(array(&#8216;pageNumber&#8217; =&gt; 1,<br />
&#8216;includeLists&#8217; =&gt; true,<br />
&#8216;filter&#8217; =&gt; $filter,<br />
));<br />
if(!isset($this-&gt;contact-&gt;return-&gt;id))<br />
{<br />
<span style="color: #ff0000;">//return &#8216;Email not subscribed&#8217;;</span><br />
}<br />
else<br />
{<br />
$this-&gt; contactId = $this-&gt;contact-&gt;return-&gt;id;<br />
//return $this-&gt;contactId;<br />
}</p>
<p>$this-&gt; recipientObject = array(&#8216;type&#8217; =&gt; &#8216;contact&#8217;, &#8216;id&#8217; =&gt; $this-&gt;contactId);<br />
}</p>
<p><span style="color: #800000;">public function setDelivery</span>($messageid){<br />
$delivery = array(&#8216;start&#8217; =&gt; date(&#8216;c&#8217;),<br />
&#8216;messageId&#8217; =&gt; $messageid,<br />
&#8216;fromName&#8217; =&gt; $this-&gt; fromName,<br />
&#8216;fromEmail&#8217; =&gt; $this-&gt; fromEmail,<br />
&#8216;recipients&#8217; =&gt; array($this-&gt; recipientObject),<br />
);</p>
<p>$this-&gt;client-&gt;addDeliveries(array($delivery));<br />
}<br />
}<br />
<span style="color: #ff0000;">? &gt;</span></p>
<p><span style="color: #000000;">called from another Zend Controller as a helper in this fashion:</span></p>
<p>$this-&gt; _helper-&gt;<span style="color: #008000;"> BrontoSendMessage</span>-&gt;<span style="color: #0000ff;">login</span>();<br />
$this-&gt; _helper-&gt; <span style="color: #008000;">BrontoSendMessage</span>-&gt;<span style="color: #0000ff;">setContact</span>($this-&gt; email);<br />
$this-&gt; _helper-&gt; <span style="color: #008000;">BrontoSendMessage</span>-&gt;<span style="color: #0000ff;">setDelivery</span>($this-&gt; messageid);</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/bronto-class-to-send-a-contact-a-particular-message-zend-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bronto Direct Import API import .csv file (upload) via HTML form post or via PHP CURL with code examples</title>
		<link>http://alexyz.com/bronto-direct-import-api-dump-csv-via-form-post-or-php-curl-examples/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bronto-direct-import-api-dump-csv-via-form-post-or-php-curl-examples</link>
		<comments>http://alexyz.com/bronto-direct-import-api-dump-csv-via-form-post-or-php-curl-examples/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 22:46:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bronto]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1382</guid>
		<description><![CDATA[We are building a Cassandra based system (of record) to capture emails so that we can handle 100k users converging on an online event as quickly as possible.  Rather than relying on our third party email marketing vendor, Bronto, to handle the volume we could possibly experience, and risk possibly failing (as others doing the [...]]]></description>
			<content:encoded><![CDATA[<p>We are building a Cassandra based system (of record) to capture emails so that we can handle 100k users converging on an online event as quickly as possible.  Rather than relying on our third party email marketing vendor, Bronto, to handle the volume we could possibly experience, and risk possibly failing (as others doing the same thing recently have done&#8230;cough cough&#8230;.Oprah and Eckhart Tolle), we&#8217;ll build our own system that can be tested correctly, and thus handle the volume, and then we&#8217;ll dump said new emails in reasonably sized files out to Bronto, who will then send out confirmation emails for us&#8230;</p>
<p>This post covers the script that will take file exports from Cassandra (sorry, no Cassandra in this one&#8230;), and Post them to Bronto.  Below is an example that uses a standard HTML form Post, for understanding and comprehensiveness, and an example that uses CURL (which easily allows this process to happen as part of an ordinary CRON job).</p>
<p>First we have to set up, and get some connection values, from Bronto:</p>
<ul>
<li>Log into Bronto</li>
<li>From the top menu select <strong>Home-&gt;Settings</strong></li>
<li>select <strong>Data Exchange</strong></li>
<li>scroll to the bottom to <strong>Direct Import</strong> and grab the following connection values:<strong> </strong>
<ul>
<li><strong>URL:</strong> <span style="color: #0000ff;">http://app.bronto.com/mail/subscriber_upload/index/</span><strong> </strong></li>
<li><strong>site_id: </strong><span style="color: #0000ff;">YOUR_SITE_ID</span><strong></strong></li>
<li><strong>user_id:</strong> <span style="color: #0000ff;">YOUR_USER_ID</span><strong></strong></li>
<li><strong>key:</strong> <span style="color: #0000ff;">YOUR_KEY</span></li>
</ul>
</li>
</ul>
<div>Further reference, Bronto support docs are here:<br />
<a href="https://app.bronto.com/mail/help/help_view/?k=mail:home:api_tracking:tracking_direct_import" target="_blank">https://app.bronto.com/mail/help/help_view/?k=mail:home:api_tracking:tracking_direct_import<br />
</a>&nbsp;</p>
<p>Next let&#8217;s look at what this Post might look like as your common HTML form:</p>
<p><span style="color: #008000;">&lt;form method=&#8221;post&#8221; action=&#8221;</span><span style="color: #0000ff;">http://app.bronto.com/mail/subscriber_upload/index/</span><span style="color: #008000;">&#8221; enctype=&#8221;multipart/form-data&#8221;&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;text&#8221; name=&#8221;source&#8221; value=&#8221;</span><span style="color: #0000ff;">Test Contacts</span><span style="color: #008000;">&#8221; /&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;text&#8221; name=&#8221;format&#8221; value=&#8221;</span><span style="color: #0000ff;">csv</span><span style="color: #008000;">&#8221; /&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;file&#8221; name=&#8221;filename&#8221; value=&#8221;</span><span style="color: #0000ff;">C:\xampp\htdocs\YOUSITEFOLDERPATH\batch.csv</span><span style="color: #008000;">&#8221; /&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;text&#8221; name=&#8221;site_id&#8221; value=&#8221;</span><span style="color: #0000ff;">YOUR_SITE_ID</span><span style="color: #008000;">&#8221; /&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;text&#8221; name=&#8221;user_id&#8221; value=&#8221;</span><span style="color: #0000ff;">YOUR_USER_ID</span><span style="color: #008000;">&#8221; /&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;text&#8221; name=&#8221;key&#8221; value=&#8221;</span><span style="color: #0000ff;">YOUR_KEY</span><span style="color: #008000;">&#8221; /&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;submit&#8221; name=&#8221;submit&#8221; value=&#8221;submit&#8221; /&gt;</span><br />
<span style="color: #008000;">&lt;/form&gt;<br />
</span></p>
<p><span style="color: #008000;"><span style="color: #000000;">Next let&#8217;s look at what this Post might look like in a PHP script using CURL:</span></span></p>
<p><span style="color: #ff0000;">&lt;? php</span><br />
$fields = <span style="color: #008000;">array</span>(<br />
&#8216;<span style="color: #0000ff;">source</span>&#8216;=&gt;&#8221;<span style="color: #0000ff;">Test contacts</span>&#8220;,<br />
&#8216;<span style="color: #0000ff;">format</span>&#8216;=&gt;<span style="color: #0000ff;">csv</span>,<br />
&#8216;<span style="color: #0000ff;">filename</span>&#8216;=&gt;&#8217;<span style="color: #0000ff;">@</span>&#8216;.&#8217;<span style="color: #0000ff;">C:\xampp\htdocs\YOURSITEFOLDERPATH\batch.csv</span>&#8216;,<br />
&#8216;<span style="color: #0000ff;">site_id</span>&#8216;=&gt;<span style="color: #0000ff;">YOUR_SITE_ID</span>,<br />
&#8216;<span style="color: #0000ff;">user_id</span>&#8216;=&gt;<span style="color: #0000ff;">YOUR_USER_ID</span>,<br />
&#8216;<span style="color: #0000ff;">key</span>&#8216;=&gt;&#8217;<span style="color: #0000ff;">YOUR_KEY</span>&#8216;,<br />
);</p>
<p><strong>/* The key here is the &#8216;@&#8217; above, which tells CURLOPT_POSTFIELDS to UPLOAD that file, parenthesis critical! */</strong></p>
<p>$ch = <span style="color: #008000;">curl_init</span>();<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #008000;">CURLOPT_URL</span>, &#8216;<span style="color: #0000ff;">http://app.bronto.com/mail/subscriber_upload/index/</span>&#8216;);<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #008000;">CURLOPT_POST</span>, <span style="color: #008000;">count</span>($fields));<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #008000;">CURLOPT_POSTFIELDS</span>, $fields);<br />
$result = <span style="color: #008000;">curl_exec</span>($ch);<br />
<span style="color: #008000;">curl_close</span>($ch);</p>
<p><span style="color: #008000;">var_dump</span>($result);<br />
<span style="color: #ff0000;">? &gt;</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Last but not least, make (or in our case receive from Cassandra export dump) the .csv file to be Posted.<br />
First column, Email, 2nd through n filled with email addresses, save it as .csv comma delineated.<br />
Yes, it&#8217;s actually that simple.<br />
I hope this helps somebody.<br />
</span></span></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/bronto-direct-import-api-dump-csv-via-form-post-or-php-curl-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a php page with a form that searches (curls) two separate WordPress applications</title>
		<link>http://alexyz.com/creating-a-php-search-page-that-searches-curls-two-separate-wordpress-applications/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-a-php-search-page-that-searches-curls-two-separate-wordpress-applications</link>
		<comments>http://alexyz.com/creating-a-php-search-page-that-searches-curls-two-separate-wordpress-applications/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 23:28:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1376</guid>
		<description><![CDATA[We have many installations where I work, some of them newer, some older, some severely whacked at by coders, some pretty much default installations. Anyhow, now they want a page from which a visitor could enter a search term, click submit, and get results from all of the separate applications! Here is my solution: The [...]]]></description>
			<content:encoded><![CDATA[<p>We have many installations where I work, some of them newer, some older, some severely whacked at by coders, some pretty much default installations.</p>
<p>Anyhow, now they want a page from which a visitor could enter a search term, click submit, and get results from all of the separate applications!</p>
<p>Here is my solution:</p>
<p>The new page has your basic self submitting form:</p>
<p><span style="color: #008000;">&lt;form action=&#8221;" method=&#8221;post&#8221;&gt;</span><br />
<span style="color: #008000;"> &lt;label for=&#8221;search&#8221;&gt;Search:&lt;/label&gt;</span><br />
<span style="color: #008000;"> &lt;input name=&#8221;s&#8221; type=&#8221;text&#8221; value=&#8221;"  /&gt;</span><br />
<span style="color: #008000;"> &lt;input type=&#8221;submit&#8221; /&gt;</span><br />
<span style="color: #008000;">&lt;/form&gt;</span></p>
<p>Then, of course, it grabs what has been submitted:</p>
<p><span style="color: #ff0000;">&lt;?php</span></p>
<p><span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;"> * Get Search parameters</span><br />
<span style="color: #ff6600;"> */</span><br />
$search = <span style="color: #008000;">$_POST['s']</span>;<br />
$search = <span style="color: #008000;">str_replace</span>(&#8221; &#8220;,&#8221;%20&#8243;,$search);<br />
<span style="color: #008000;">echo</span> $search;</p>
<p><span style="color: #ff0000;">?&gt;</span></p>
<p><span style="color: #000000;">This checks to ensure that the user didn&#8217;t submit nothing (as WordPress would give us every post as currently coded&#8230;! ick)</span>.  This would also be a great place to guard against injection attacks (or in the last step of course), to filter what may be searched for, etc., but I&#8217;ll leave those concerns for another discussion:</p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
<span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;"> * If desired search is NOT empty, search, otherwise don&#8217;t</span><br />
<span style="color: #ff6600;"> */</span><br />
<span style="color: #008000;">if</span>(($search != &#8221;) <span style="color: #008000;">&amp;&amp;</span> ($search != null) <span style="color: #008000;">&amp;&amp;</span> (!empty($search)) )<br />
{<br />
<span style="color: #ff0000;">?&gt;</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Now we curl in the results from each installation:</span></span></p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
<span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;"> * Get Search results from WP app 1</span><br />
<span style="color: #ff6600;"> */</span><br />
$sub_req_url = &#8220;http://<strong>YOURAPP<span style="color: #ff0000;">1</span>URLHERE</strong>/searchpage.php?s=&#8221; . <span style="color: #0000ff;">$search</span>;<br />
$ch = <span style="color: #008000;">curl_init</span>($sub_req_url);<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #0000ff;">CURLOPT_HEADER</span>, 0);<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #0000ff;">CURLOPT_POST</span>, 1);<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #0000ff;">CURLOPT_RETURNTRANSFER</span>, 1);<br />
$podcast_return = <span style="color: #008000;">curl_exec</span>($ch);<br />
<span style="color: #008000;">curl_close</span>($ch);<br />
<span style="color: #008000;">echo</span> $podcast_return;</p>
<p><span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;"> * End</span><br />
<span style="color: #ff6600;"> */</span><br />
<span style="color: #ff0000;">?&gt;</span></p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
<span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;"> * Get Search results from WP app 2</span><br />
<span style="color: #ff6600;"> */</span><br />
$sub_req_url = &#8220;http://<strong>YOURAPP<span style="color: #ff0000;">2</span>URLHERE</strong>/searchpage.php?s=&#8221; . <span style="color: #0000ff;">$search</span>;<br />
$ch = <span style="color: #008000;">curl_init</span>($sub_req_url);<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #0000ff;">CURLOPT_HEADER</span>, 0);<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #0000ff;">CURLOPT_POST</span>, 1);<br />
<span style="color: #008000;">curl_setopt</span>($ch, <span style="color: #0000ff;">CURLOPT_RETURNTRANSFER</span>, 1);<br />
$podcast_return = <span style="color: #008000;">curl_exec</span>($ch);<br />
<span style="color: #008000;">curl_close</span>($ch);<br />
<span style="color: #008000;">echo</span> $podcast_return;</p>
<p><span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;"> * End</span><br />
<span style="color: #ff6600;"> */</span><br />
<span style="color: #ff0000;">?&gt;</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Now let&#8217;s close our IF block, and maybe provide ELSE if we want to&#8230;</span></span></p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
<span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;"> * close if empty block</span><br />
<span style="color: #ff6600;"> */</span><br />
}<br />
else<br />
{<br />
}<br />
<span style="color: #ff0000;">?&gt;</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Ok, that&#8217;s the end of our new page, again, I&#8217;ll leave formatting of the results and the rest of the page to another discussion.  Now let&#8217;s make the above mentioned search pages &#8220;searchpage.php&#8221; (<strong><span style="color: #ff0000;">make one for EACH APP, lives in the ROOT of EACH WP installation that we&#8217;re searching!</span></strong>):</span></span></p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
<span style="color: #ff6600;">/**</span><br />
<span style="color: #ff6600;">* WordPress App 1 Post Results Pull-In </span><br />
<span style="color: #ff6600;">*/</span><br />
<span style="color: #008000;">define</span>(&#8216;<span style="color: #0000ff;">WP_USE_THEMES</span>&#8216;, true);<br />
<span style="color: #008000;">include</span>(&#8216;wp-load.php&#8217; );<br />
$query = <span style="color: #008000;">new</span> WP_Query(&#8216;s=&#8217; . <span style="color: #008000;">$_GET['s']</span>);<br />
<span style="color: #008000;">if </span>($query-&gt;have_posts()) : while ($query-&gt;have_posts()) <span style="color: #008000;">:</span> $query-&gt;the_post(); <span style="color: #ff0000;">?&gt;</span></p>
<p>/* Again, how you choose to skin the results could be implemented here, but I&#8217;ll leave that up to you&#8230; */</p>
<p><span style="color: #008000;">&lt;div id=&#8221;post-</span><span style="color: #ff0000;">&lt;?php</span> <span style="color: #008000;">the_ID()</span>; <span style="color: #ff0000;">?&gt;</span>&#8220;&gt;<br />
<span style="color: #008000;">&lt;h2&gt;</span><span style="color: #ff0000;">&lt;?php</span> <span style="color: #008000;">the_title()</span>; ?&gt;<span style="color: #008000;">&lt;/h2&gt;</span><br />
<span style="color: #008000;">&lt;div&gt;</span><br />
<span style="color: #ff0000;">&lt;?php</span> <span style="color: #008000;">the_content</span>(&#8216;<span style="color: #008000;">&lt;p&gt;Read the rest of this page &amp;raquo;&lt;/p&gt;</span>&#8216;); <span style="color: #ff0000;">?&gt;</span><br />
<span style="color: #ff0000;">&lt;?php</span><span style="color: #008000;"> wp_link_pages</span>(array(&#8216;before&#8217; =&gt; &#8216;<span style="color: #008000;">&lt;p&gt;&lt;strong&gt;Pages:&lt;/strong&gt;</span> &#8216;, &#8216;after&#8217; =&gt; &#8216;<span style="color: #008000;">&lt;/p&gt;</span>&#8216;, &#8216;next_or_number&#8217; =&gt; &#8216;number&#8217;)); <span style="color: #ff0000;">?&gt;</span><br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
<span style="color: #ff0000;">&lt;?php</span> <span style="color: #008000;">endwhile; endif;</span> <span style="color: #ff0000;">?&gt;</span></p>
<p><strong>Whoohoo! Great Work!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/creating-a-php-search-page-that-searches-curls-two-separate-wordpress-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP script to download .ics Outlook Event Schedule Calendar Alarm add</title>
		<link>http://alexyz.com/php-script-to-download-ics-outlook-event-schedule-calendar-alarm-add/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-script-to-download-ics-outlook-event-schedule-calendar-alarm-add</link>
		<comments>http://alexyz.com/php-script-to-download-ics-outlook-event-schedule-calendar-alarm-add/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 21:32:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1374</guid>
		<description><![CDATA[My boss wanted the ability to put a button on an event on our site that would book it in the user&#8217;s Outlook calendar.  Short story is the link downloads an .ics file to their computer, opened with Outlook it schedules the Event, Reminder, Priority, Schedule, and so on.  Thank you http://www.myhow2guru.com &#60;?php //This is [...]]]></description>
			<content:encoded><![CDATA[<p>My boss wanted the ability to put a button on an event on our site that would book it in the user&#8217;s Outlook calendar.  Short story is the link downloads an .ics file to their computer, opened with Outlook it schedules the Event, Reminder, Priority, Schedule, and so on.  Thank you <a href="http://www.myhow2guru.com">http://www.myhow2guru.com</a></p>
<p>&lt;?php<br />
//This is the most important coding.<br />
header(&#8220;Content-Type: text/Calendar&#8221;);<br />
header(&#8220;Content-Disposition: inline; filename=filename.ics&#8221;);<br />
echo &#8220;BEGIN:VCALENDAR\n&#8221;;<br />
echo &#8220;PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\n&#8221;;<br />
echo &#8220;VERSION:2.0\n&#8221;;<br />
echo &#8220;METHOD:PUBLISH\n&#8221;;<br />
echo &#8220;X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n&#8221;;<br />
echo &#8220;BEGIN:VEVENT\n&#8221;;<br />
echo &#8220;CLASS:PUBLIC\n&#8221;;<br />
echo &#8220;CREATED:20091109T101015Z\n&#8221;;<br />
echo &#8220;DESCRIPTION:How 2 Guru Event\\n\\n\\nEvent Page\\n\\nhttp://www.myhow2guru.com\n&#8221;;<br />
echo &#8220;DTEND:20091208T040000Z\n&#8221;;<br />
echo &#8220;DTSTAMP:20091109T093305Z\n&#8221;;<br />
echo &#8220;DTSTART:20091208T003000Z\n&#8221;;<br />
echo &#8220;LAST-MODIFIED:20091109T101015Z\n&#8221;;<br />
echo &#8220;LOCATION:Anywhere have internet\n&#8221;;<br />
echo &#8220;PRIORITY:5\n&#8221;;<br />
echo &#8220;SEQUENCE:0\n&#8221;;<br />
echo &#8220;SUMMARY;LANGUAGE=en-us:How2Guru Event\n&#8221;;<br />
echo &#8220;TRANSP:OPAQUE\n&#8221;;<br />
echo &#8220;UID:040000008200E00074C5B7101A82E008000000008062306C6261CA01000000000000000\n&#8221;;<br />
echo &#8220;X-MICROSOFT-CDO-BUSYSTATUS:BUSY\n&#8221;;<br />
echo &#8220;X-MICROSOFT-CDO-IMPORTANCE:1\n&#8221;;<br />
echo &#8220;X-MICROSOFT-DISALLOW-COUNTER:FALSE\n&#8221;;<br />
echo &#8220;X-MS-OLK-ALLOWEXTERNCHECK:TRUE\n&#8221;;<br />
echo &#8220;X-MS-OLK-AUTOFILLLOCATION:FALSE\n&#8221;;<br />
echo &#8220;X-MS-OLK-CONFTYPE:0\n&#8221;;<br />
//Here is to set the reminder for the event.<br />
echo &#8220;BEGIN:VALARM\n&#8221;;<br />
echo &#8220;TRIGGER:-PT1440M\n&#8221;;<br />
echo &#8220;ACTION:DISPLAY\n&#8221;;<br />
echo &#8220;DESCRIPTION:Reminder\n&#8221;;<br />
echo &#8220;END:VALARM\n&#8221;;<br />
echo &#8220;END:VEVENT\n&#8221;;<br />
echo &#8220;END:VCALENDAR\n&#8221;;<br />
? &gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-script-to-download-ics-outlook-event-schedule-calendar-alarm-add/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress base url path for multiple platform development links</title>
		<link>http://alexyz.com/wordpress-base-url-path-for-multip-platform-development-links/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-base-url-path-for-multip-platform-development-links</link>
		<comments>http://alexyz.com/wordpress-base-url-path-for-multip-platform-development-links/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 17:33:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1370</guid>
		<description><![CDATA[so that anchor tags always nicely point to your application root use: get_bloginfo('url') http://codex.wordpress.org/Template_Tags/get_bloginfo]]></description>
			<content:encoded><![CDATA[<p>so that anchor tags always nicely point to your application root use:</p>
<p><span style="color: #ff0000;"><code>get_bloginfo('url')</code></span></p>
<p><a href="http://codex.wordpress.org/Template_Tags/get_bloginfo">http://codex.wordpress.org/Template_Tags/get_bloginfo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-base-url-path-for-multip-platform-development-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress the_excerpt() strips html tags, create a custom function to leave them in</title>
		<link>http://alexyz.com/wordpress-the_excerpt-stips-html-tags-create-a-custom-function-to-leave-them-in/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-the_excerpt-stips-html-tags-create-a-custom-function-to-leave-them-in</link>
		<comments>http://alexyz.com/wordpress-the_excerpt-stips-html-tags-create-a-custom-function-to-leave-them-in/#comments</comments>
		<pubDate>Fri, 27 May 2011 22:44:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1364</guid>
		<description><![CDATA[go to your theme&#8217;s function script: wp-content/themes/yourthemename/function.php at the top insert the following (add to &#8216;&#60;img&#62;&#8217; below to NOT strip out other specific tags, or simply comment the line out&#8230;): function improved_trim_excerpt($text) { global $post; if ( &#8221; == $text ) { $text = get_the_content(&#8221;); $text = apply_filters(&#8216;the_content&#8217;, $text); $text = str_replace(&#8216;]]&#62;&#8217;, &#8216;]]&#38;gt;&#8217;, $text); $text [...]]]></description>
			<content:encoded><![CDATA[<p>go to your theme&#8217;s function script:</p>
<p><span style="color: #0000ff;">wp-content/themes/yourthemename/function.php</span></p>
<p>at the top insert the following (add to &#8216;&lt;img&gt;&#8217; below to NOT strip out other specific tags, or simply comment the line out&#8230;):</p>
<p><span style="color: #ff0000;">function improved_trim_excerpt($text) {</span><br />
<span style="color: #ff0000;"> global $post;</span><br />
<span style="color: #ff0000;"> if ( &#8221; == $text ) {</span><br />
<span style="color: #ff0000;"> $text = get_the_content(&#8221;);</span><br />
<span style="color: #ff0000;"> $text = apply_filters(&#8216;the_content&#8217;, $text);</span><br />
<span style="color: #ff0000;"> $text = str_replace(&#8216;]]&gt;&#8217;, &#8216;]]&amp;gt;&#8217;, $text);</span><br />
<span style="color: #ff0000;"> $text = strip_tags($text, &#8216;&lt;img&gt;&#8217;);</span><br />
<span style="color: #ff0000;"> $excerpt_length = 55;</span><br />
<span style="color: #ff0000;"> $words = explode(&#8216; &#8216;, $text, $excerpt_length + 1);</span><br />
<span style="color: #ff0000;"> if (count($words)&gt; $excerpt_length) {</span><br />
<span style="color: #ff0000;"> array_pop($words);</span><br />
<span style="color: #ff0000;"> array_push($words, &#8216;[...]&#8216;);</span><br />
<span style="color: #ff0000;"> $text = implode(&#8216; &#8216;, $words);</span><br />
<span style="color: #ff0000;"> }</span><br />
<span style="color: #ff0000;"> }</span><br />
<span style="color: #ff0000;"> return $text;</span><br />
<span style="color: #ff0000;">}</span><br />
<span style="color: #ff0000;">remove_filter(&#8216;get_the_excerpt&#8217;,'wp_trim_excerpt&#8217;);</span><br />
<span style="color: #ff0000;">add_filter(&#8216;get_the_excerpt&#8217;,'improved_trim_excerpt&#8217;);</span></p>
<p><span style="color: #000000;">some references:</span> <a href="http://codex.wordpress.org/Function_Reference/the_excerpt">http://codex.wordpress.org/Function_Reference/the_excerpt</a>, http://www.aaronrussell.co.uk/blog/improving-wordpress-the_excerpt/</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-the_excerpt-stips-html-tags-create-a-custom-function-to-leave-them-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Facebook App</title>
		<link>http://alexyz.com/create-a-facebook-app/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-a-facebook-app</link>
		<comments>http://alexyz.com/create-a-facebook-app/#comments</comments>
		<pubDate>Thu, 26 May 2011 22:31:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[facebook]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1360</guid>
		<description><![CDATA[first visit facebook and register your new app: http://www.facebook.com/developers configure the facebook settings to point to your server grab the facebook php library: http://github.com/facebook/php-sdk/tarball/master or here: developers.facebook.com/resources.php upload your application&#8217;s new index.php to your server, something like this: &#60;? php require_once &#8216;facebook.php&#8217;; $appapikey = &#8217;1234&#8242;; $appsecret = &#8217;1234&#8242;; $facebook = new Facebook($appapikey, $appsecret); $user_id = [...]]]></description>
			<content:encoded><![CDATA[<p>first visit facebook and register your new app:<br />
<a href="http://www.facebook.com/developers">http://www.facebook.com/developers</a><br />
configure the facebook settings to point to your server</p>
<p>grab the facebook php library:<br />
<a href="http://github.com/facebook/php-sdk/tarball/master">http://github.com/facebook/php-sdk/tarball/master</a><br />
or here:<br />
<a href="http://developers.facebook.com/resources.php">developers.facebook.com/resources.php</a></p>
<p>upload your application&#8217;s new index.php to your server, something like this:</p>
<p><span style="color: #ff0000;">&lt;? php</span><br />
<span style="color: #ff0000;">require_once &#8216;facebook.php&#8217;;</span><br />
<span style="color: #ff0000;">$appapikey = &#8217;1234&#8242;;</span><br />
<span style="color: #ff0000;">$appsecret = &#8217;1234&#8242;;</span><br />
<span style="color: #ff0000;">$facebook = new Facebook($appapikey, $appsecret);</span><br />
<span style="color: #ff0000;">$user_id = $facebook-&gt;require_login();  $html = &#8216;PUT YOUR HTML HERE&#8217;;</span><br />
<span style="color: #ff0000;">$facebook-&gt;api_client-&gt;profile_setFBML(NULL, $user_id, $html, NULL, NULL, $html);</span><br />
<span style="color: #ff0000;"> echo &#8216;&lt;br /&gt;&lt;fb:add-section-button section=&#8221;profile&#8221; /&gt;&#8217;;</span><br />
<span style="color: #ff0000;">? &gt;</span></p>
<p>it&#8217;s that simple.</p>
<p>references:</p>
<p><a href="http://www.youtube.com/watch?v=roOYZKsN3Yg">http://www.youtube.com/watch?v=roOYZKsN3Yg</a><br />
<a href="http://www.merchantos.com/blog/makebeta/facebook/facebook-php-tutorial">http://www.merchantos.com/blog/makebeta/facebook/facebook-php-tutorial</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/create-a-facebook-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dreamweaver Remember and re-open documents when closed</title>
		<link>http://alexyz.com/dreamweaver-remember-and-re-open-documents-when-closed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dreamweaver-remember-and-re-open-documents-when-closed</link>
		<comments>http://alexyz.com/dreamweaver-remember-and-re-open-documents-when-closed/#comments</comments>
		<pubDate>Tue, 24 May 2011 23:20:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Dreamweaver]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1357</guid>
		<description><![CDATA[Are you wanting to close Dreamweaver, and work on that task tomorrow, but you have all of the files that you need open, and you don&#8217;t want to find them all and have to open them all again? Do you want Dreamweaver to remember which files were open, and open them all again for you? [...]]]></description>
			<content:encoded><![CDATA[<p>Are you wanting to close Dreamweaver,<br />
and work on that task tomorrow,<br />
but you have all of the files that you need open,<br />
and you don&#8217;t want to find them all and have to open them all again?<br />
Do you want Dreamweaver to remember which files were open,<br />
and open them all again for you?<br />
(Something that is default, by the way, in something like Zend Studio, enough said&#8230;)</p>
<p><em>Preferences:</em></p>
<p><strong>Edit | Preferences | General | Document Options: Reopen documents at startup</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/dreamweaver-remember-and-re-open-documents-when-closed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress convert podcast from Podpress to Powerpress support HTML5 mobile devices</title>
		<link>http://alexyz.com/wordpress-convert-podcast-from-podpress-to-powerpress-support-html5-mobile-devices/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-convert-podcast-from-podpress-to-powerpress-support-html5-mobile-devices</link>
		<comments>http://alexyz.com/wordpress-convert-podcast-from-podpress-to-powerpress-support-html5-mobile-devices/#comments</comments>
		<pubDate>Thu, 12 May 2011 17:08:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Podpress]]></category>
		<category><![CDATA[Powerpress]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1349</guid>
		<description><![CDATA[If you found this post, you think you&#8217;re stuck with Podpress, and/or you&#8217;re wanting to make your podcast viewable on mobile devices.  I was in the same boat until just recently, stuck with a podcast I&#8217;d initially setup with Podpress years ago, support for which has been worryingly spotty and dwindling, wishing I could now [...]]]></description>
			<content:encoded><![CDATA[<p>If you found this post, you think you&#8217;re stuck with <a href="http://wordpress.org/extend/plugins/podpress/">Podpress</a>, and/or you&#8217;re wanting to make your podcast viewable on mobile devices.  I was in the same boat until just recently, stuck with a podcast I&#8217;d initially setup with <a href="http://wordpress.org/extend/plugins/podpress/">Podpress</a> years ago, support for which has been worryingly spotty and dwindling, wishing I could now ditch <a href="http://wordpress.org/extend/plugins/podpress/">Podpress</a>, but I had over 160 posts I didn&#8217;t want to convert&#8230;.</p>
<p>What I didn&#8217;t realize is that the creators of <a href="http://www.blubrry.com/powerpress/">Powerpress</a> had exactly that in mind when they developed <a href="http://www.blubrry.com/powerpress/">Powerpress</a>!  All I had to do was install <a href="http://www.blubrry.com/powerpress/">Powerpress</a>, activate it, ensure that it&#8217;s settings were correct, and then deactivate Podpress, and bam, it worked. SO <span style="color: #ff0000;">AWESOME</span>, highly recommended.</p>
<p>So I can successfully declare today, that I&#8217;ve migrated now 3 podcasts from <a href="http://wordpress.org/extend/plugins/podpress/">Podpress</a> to <a href="http://www.blubrry.com/powerpress/">Powerpress</a>, one with 84 posts, one with 164, another with 11.</p>
<ul>
<li>The feeds are unaffected, <a href="http://feedburner.google.com">Feedburner</a> is completely unaware of the change</li>
<li>views/layouts unaltered</li>
<li>I didn&#8217;t even need to go back into the posts and alter the data, <a href="http://www.blubrry.com/powerpress/">Powerpress</a> simply interprets it</li>
<li><a href="http://www.apple.com/itunes/">iTunes</a> unaffected</li>
<li><a href="http://www.blubrry.com/powerpress/">Powerpress</a> serves up the <a href="http://get.adobe.com/flashplayer/">flashplayer</a> if the requesting browser support <a href="http://get.adobe.com/flashplayer/">flash</a>, and theL <a href="http://dev.w3.org/html5/spec/Overview.html">HTML5</a> audio or video player if it doesn&#8217;t, enabling by many versions of the <a href="http://www.apple.com/ipod/">iPod</a>, <a href="http://www.apple.com/ipad/">iPad</a>, <a href="http://www.android.com/">Android</a>, and so on, handled, done!</li>
<li><span style="color: #ff0000;">HUGE</span> win.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-convert-podcast-from-podpress-to-powerpress-support-html5-mobile-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Persistence of GET URL parameters passed to WordPress site with Permalink clean pretty URLs turned on</title>
		<link>http://alexyz.com/persistence-of-get-url-parameters-passed-to-wordpress-site-with-permalink-clean-pretty-urls-turned-on/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=persistence-of-get-url-parameters-passed-to-wordpress-site-with-permalink-clean-pretty-urls-turned-on</link>
		<comments>http://alexyz.com/persistence-of-get-url-parameters-passed-to-wordpress-site-with-permalink-clean-pretty-urls-turned-on/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 20:16:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1345</guid>
		<description><![CDATA[Here&#8217;s the scenario: We have a store site. The store site has a link on its homepage that leads to a wordpress site. When a visitor clicks the link, we want a url parameter that is passed with the visitor to the wordpress site to remain in the url so that when/if they click a [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the scenario:<br />
We have a store site.<br />
The store site has a link on its homepage that leads to a wordpress site.<br />
When a visitor clicks the link,<br />
we want a url parameter that is passed with the visitor to the wordpress site<br />
to remain in the url<br />
so that when/if they click a link in the wordpress site that leads back to the store,<br />
the parameter comes back with them.</p>
<p>Normally, you&#8217;d simply add a $_GET in your theme somewhere,<br />
assign it to a variable,<br />
and then append that onto any links that are headed back to the store site.</p>
<p>The trouble, though, is that when WordPress&#8217;<br />
clean and pretty Permalinks URL function is active,<br />
it takes over, and forwards (via htaccess, wordpress base code functions, or otherwise),<br />
at which point in time data passed over is lost.</p>
<p>Solution:<br />
In WordPress&#8217; index.php (the very first root directory index),<br />
include another file.</p>
<p><span style="color: #ff0000;">include(&#8216;passback.php&#8217;);</span></p>
<p>In that file, instantiate SERVER SESSIONS, and save received parameters.<br />
Something like this (of course looping through the REQUEST parameters dynamically would be smarter, but for simplicities sake, let&#8217;s just target a particular parameter):</p>
<p><span style="color: #ff0000;">session_start();</span><br />
<span style="color: #ff0000;">if($_GET['persistme'] != &#8221;){ $passit = $_GET['persistme']; }</span><br />
<span style="color: #ff0000;">if(!isset($_SESSION['passback'])){ $_SESSION['passback'] = $passit; }</span></p>
<p>Now you can include your passback retrieval class in your theme, grab the parameter, and use your JavaScript library of choice to loop through all the links in the page and append it onto them.<br />
Something like this (Prototype, and only appending links that already have a ? and thus other parameters they&#8217;re sending back&#8230;):</p>
<p><span style="color: #ff0000;">document.observe(&#8216;dom:loaded&#8217;, function() {</span><br />
<span style="color: #ff0000;"> $$(&#8220;a&#8221;).each(function(a) {</span><br />
<span style="color: #ff0000;"> newhref = a.href;</span><br />
<span style="color: #ff0000;"> if(newhref.include(&#8216;?&#8217;){</span><br />
<span style="color: #ff0000;">newhref = a.href + &#8220;?rememberme=&lt;?php echo $passit; ?&gt;&#8221;;</span><br />
<span style="color: #ff0000;"> a.writeAttribute(&#8216;href&#8217;, newhref);</span><br />
<span style="color: #ff0000;"> }</span><br />
<span style="color: #ff0000;"> });</span><br />
<span style="color: #ff0000;">});</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/persistence-of-get-url-parameters-passed-to-wordpress-site-with-permalink-clean-pretty-urls-turned-on/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery json crossdomain example</title>
		<link>http://alexyz.com/jquery-json-crossdomain-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-json-crossdomain-example</link>
		<comments>http://alexyz.com/jquery-json-crossdomain-example/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 00:18:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1342</guid>
		<description><![CDATA[&#60;script src=&#8221;http://code.jquery.com/jquery-1.5.js&#8221;&#62;&#60;/script&#62; &#60;script&#62; $(&#8220;#enews_signup_form&#8221;).submit(function(event) { // stop form from submitting normally event.preventDefault(); $( &#8220;#result&#8221; ).html (&#8220;submitting&#8230;&#8221;); var $form = $( this ), term = $form.find( &#8216;input[name="enews_email"]&#8216; ).val(), url = $form.attr( &#8216;action&#8217; ); $.getJSON(url + &#8220;?email=&#8221; + term + &#8220;&#38;jsoncallback=?&#8221;, function(data){ $( &#8220;#result&#8221; ).html( data['error'] ); }); }); &#60;/script&#62; &#60;? php echo $_REQUEST['jsoncallback'] . &#8216;(&#8216; . [...]]]></description>
			<content:encoded><![CDATA[<p>&lt;script src=&#8221;http://code.jquery.com/jquery-1.5.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script&gt;</p>
<p>$(&#8220;#enews_signup_form&#8221;).submit(function(event) {</p>
<p>// stop form from submitting normally<br />
event.preventDefault();</p>
<p>$( &#8220;#result&#8221; ).html (&#8220;submitting&#8230;&#8221;);</p>
<p>var $form = $( this ),<br />
term = $form.find( &#8216;input[name="enews_email"]&#8216; ).val(),<br />
url = $form.attr( &#8216;action&#8217; );</p>
<p>$.getJSON(url + &#8220;?email=&#8221; + term + &#8220;&amp;jsoncallback=?&#8221;, function(data){<br />
$( &#8220;#result&#8221; ).html( data['error'] );<br />
});</p>
<p>});</p>
<p>&lt;/script&gt;</p>
<p>&lt;? php</p>
<p>echo $_REQUEST['jsoncallback'] . &#8216;(&#8216; . json_encode($this-&gt; viewresult) . &#8216;)&#8217;;</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-json-crossdomain-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iTunes remove podcast example rss xml feed itunes:block</title>
		<link>http://alexyz.com/itunes-remove-podcast-examle-xml-feed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=itunes-remove-podcast-examle-xml-feed</link>
		<comments>http://alexyz.com/itunes-remove-podcast-examle-xml-feed/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 23:58:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Feedburner]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1327</guid>
		<description><![CDATA[So you submitted your podcast, with a post containing placeholder content because you had to have it approved and live by some deadline, but now it&#8217;s deemed not presentable, because marketing has changed the title last minute, and as you change this first post&#8217;s content via its RSS feed, some of it changes, the dynamic [...]]]></description>
			<content:encoded><![CDATA[<p>So you submitted your podcast, with a post containing placeholder content because you had to have it approved and live by some deadline, but now it&#8217;s deemed not presentable, because marketing has changed the title last minute, and as you change this first post&#8217;s content via its RSS feed, some of it changes, the dynamic parts most likely, the media, and so on, but the title isn&#8217;t changing in the iTunes store&#8230;</p>
<p>In my example, I used a feedburner feed (iTunes is using that), so I can simply change the feed source in feedburner, to something like the example xml feed in this post, and we can at least get the eyesore out of iTunes, freeing us up to make a new feedburner feed, and re-submit THAT anew to iTunes for a fresh clean go of things&#8230;</p>
<p>Host something like this somewhere, and point the old feedburner feed to it, done.</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;rss xmlns:itunes=&#8221;http://www.itunes.com/dtds/podcast-1.0.dtd&#8221; version=&#8221;2.0&#8243;&gt;<br />
&lt;channel&gt;<br />
&lt;itunes:block&gt;yes&lt;/itunes:block&gt;<br />
&lt;title&gt;A Title Is Required For The Feed To Validate&lt;/title&gt;<br />
&lt;/channel&gt;<br />
&lt;/rss&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/itunes-remove-podcast-examle-xml-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress determine version number</title>
		<link>http://alexyz.com/wordpress-determine-version-number/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-determine-version-number</link>
		<comments>http://alexyz.com/wordpress-determine-version-number/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 00:16:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1315</guid>
		<description><![CDATA[wp-includes/version.php]]></description>
			<content:encoded><![CDATA[<p>wp-includes/version.php</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-determine-version-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress custom sidebar category filtered archive code</title>
		<link>http://alexyz.com/wordpress-custom-sidebar-category-filtered-archive-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-custom-sidebar-category-filtered-archive-code</link>
		<comments>http://alexyz.com/wordpress-custom-sidebar-category-filtered-archive-code/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 00:07:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1312</guid>
		<description><![CDATA[&#60;div id=&#8221;sidebar&#8221;&#62; &#60;ul&#62; &#60;?php $myposts = get_posts(&#8220;category=1&#8243;); foreach($myposts as $post) : ?&#62; &#60;li&#62;&#60;a href=&#8221;&#60;?php the_permalink(); ?&#62;&#8220;&#62;&#60;?php the_time(&#8216;M&#8217;) ?&#62;. &#8211; &#60;?php the_title(); ?&#62;&#60;/a&#62;&#60;/li&#62; &#60;?php endforeach; ?&#62; &#60;/ul&#62; &#60;/div&#62; mostly in thanks to: http://www.z-oc.com/blog/2008/03/category-based-archive/ http://www.themightymo.com/2009/07/22/includeexclude-category-from-wordpress-wp_get_archives/ http://kwebble.com/blog/2007_08_15/archives_for_a_category]]></description>
			<content:encoded><![CDATA[<p>&lt;div id=&#8221;sidebar&#8221;&gt;<br />
&lt;ul&gt;<br />
<span style="color: #ff0000;">&lt;?php</span><br />
$myposts = <span style="color: #008000;">get_posts</span>(&#8220;category=1&#8243;);<br />
<span style="color: #008000;">foreach</span>($myposts <span style="color: #008000;">as</span> $post)<span style="color: #008000;"> :</span> <span style="color: #ff0000;">?&gt;</span><br />
&lt;li&gt;&lt;a href=&#8221;<span style="color: #ff0000;">&lt;?php</span> <span style="color: #008000;">the_permalink();</span> <span style="color: #ff0000;">?&gt;</span>&#8220;&gt;<span style="color: #ff0000;">&lt;?php</span> <span style="color: #008000;">the_time(&#8216;M&#8217;)</span> <span style="color: #ff0000;">?&gt;</span>. &#8211; <span style="color: #ff0000;">&lt;?php</span> <span style="color: #008000;">the_title();</span> <span style="color: #ff0000;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;<br />
<span style="color: #ff0000;">&lt;?php</span> endforeach; <span style="color: #ff0000;">?&gt;</span><br />
&lt;/ul&gt;<br />
&lt;/div&gt;</p>
<p>mostly in thanks to:</p>
<p><a href="http://www.z-oc.com/blog/2008/03/category-based-archive/">http://www.z-oc.com/blog/2008/03/category-based-archive/</a></p>
<p><a href="http://www.themightymo.com/2009/07/22/includeexclude-category-from-wordpress-wp_get_archives/">http://www.themightymo.com/2009/07/22/includeexclude-category-from-wordpress-wp_get_archives/</a></p>
<p><a href="http://kwebble.com/blog/2007_08_15/archives_for_a_category">http://kwebble.com/blog/2007_08_15/archives_for_a_category</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-custom-sidebar-category-filtered-archive-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Post to Category ID association in the Database</title>
		<link>http://alexyz.com/wordpress-category-id-association-in-the-database/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-category-id-association-in-the-database</link>
		<comments>http://alexyz.com/wordpress-category-id-association-in-the-database/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 00:01:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1310</guid>
		<description><![CDATA[WordPress 3 Start with a Post and get Category ID: Get the id number(A) for the post you&#8217;re interested in in wp_posts table,  id column Go to wp_term_relationships table, and find that same id number(A) in the object_id column, read over to the term_taxonomy_id column and get that number, that&#8217;s the category id Start with [...]]]></description>
			<content:encoded><![CDATA[<p><em>WordPress 3</em></p>
<p><span style="text-decoration: underline;">Start with a Post and get Category ID:</span></p>
<p>Get the id number(A) for the post you&#8217;re interested in in <strong><span style="color: #000000;">wp_posts</span></strong> table,  <span style="color: #ff0000;">id <span style="color: #000000;">column</span><br />
</span></p>
<p>Go to <strong><span style="color: #000000;">wp_term_relationships</span></strong> table, and find that same id number(A) in the <span style="color: #ff0000;">object_id</span> column, read over to the <span style="color: #ff0000;">term_taxonomy_id</span> column and get that number, that&#8217;s the <strong>category id</strong></p>
<p><span style="text-decoration: underline;">Start with a Category ID and get Category Name:</span></p>
<p>Go to the <strong>wp_terms</strong> table, and find the category you&#8217;d like in the <span style="color: #ff0000;">name</span> column, read over to the <span style="color: #ff0000;">term_id</span> and note the number</p>
<p><span style="text-decoration: underline;">Find all Cateogry IDs:</span></p>
<p>Go to the<strong> wp_term_taxonomy </strong>table<strong> </strong>and sort by<strong> </strong><span style="color: #ff0000;">taxonomy </span>value &#8216;<span style="color: #ff0000;">category</span> category number is in <span style="color: #ff0000;">term_taxonomy_id</span> column</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-category-id-association-in-the-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails : rateatrack app notes to self</title>
		<link>http://alexyz.com/ruby-on-rails-rateatrack-app-notes-to-self/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ruby-on-rails-rateatrack-app-notes-to-self</link>
		<comments>http://alexyz.com/ruby-on-rails-rateatrack-app-notes-to-self/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 04:49:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1308</guid>
		<description><![CDATA[add in item to an array/object example: @artists &#60;&#60; track.artist order object contents example: def index @tracks = Track.all(:order =&#62; &#8216;artist&#8216;) &#8230; simple rating average math: rating = params['rating'].to_i @track.average = ((@track.average * @track.numberofvotes) + newlysubmittedrating)/(@track.numberofvotes + 1) @track.numberofvotes = @track.numberofvotes + 1 simple db update conditional redirect with reporting: if @track.update_attributes(params[:track]) format.html { redirect_to(&#8220;/&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>add in item to an array/object example:</strong></p>
<p><span style="color: #ff0000;">@artists</span> &lt;&lt; track.artist</p>
<p><strong>order object contents example:</strong></p>
<p><span style="color: #008000;">def</span> index<br />
@tracks = Track.all(:order =&gt; &#8216;<span style="color: #ff0000;">artist</span>&#8216;)</p>
<p>&#8230;</p>
<p><strong>simple rating average math:</strong></p>
<p>rating = params['rating']<span style="color: #ff0000;">.to_i </span><br />
@track.average = ((@track.average * @track.numberofvotes) + newlysubmittedrating)/(@track.numberofvotes + 1)<br />
@track.numberofvotes = @track.numberofvotes + 1</p>
<p><strong>simple db update conditional redirect with reporting:</strong></p>
<p>if @track.update_attributes(params[:track])<br />
format.html { redirect_to(&#8220;/&#8221;, :notice =&gt; &#8216;Track updated.&#8217;) }</p>
<p><strong>similar db object one liners:</strong></p>
<ul>
<li>@object.save</li>
<li>@object.destroy</li>
<li>@track = Track.find(params[:id])</li>
<li>@object = Track.new</li>
<li>@record = Track.find_by_sql &#8220;SELECT * &#8230;&#8221;</li>
</ul>
<p><strong>simple char substitution:</strong></p>
<p>somevariablename = variablecontainingcharstoswap.gsub(&#8220;_&#8221;, &#8221; &#8220;)</p>
<p><strong>method simply needs to render a view other than that matching its name:</strong></p>
<p>render :viewname</p>
<p><strong>.each loop fills text variable, then renders it:</strong></p>
<p>@record.each do |track|<br />
$str &lt;&lt; &#8220;#EXTINFO:#{track.length},#{track.title}&lt;br /&gt;#{track.url}&lt;br /&gt;&#8221;<br />
end<br />
render :text =&gt; $str</p>
<p><span style="color: #ff0000;">notice: to substitute variables into such a statement, #{variablename}</span></p>
<p><strong>simple and example model with validation and some messaging:</strong></p>
<p>class Track &lt; ActiveRecord::Base<br />
validates :url,  :presence =&gt; true<br />
validates :title, :presence =&gt; true, :length =&gt; { :minimum =&gt; 1 }<br />
validates :artist, :presence =&gt; true<br />
validates :length, :presence =&gt; true<br />
validates_format_of :url, :title, :artist, :length, :with =&gt;/^[a-zA-Z \\ \/. : 0-9]+$/x, :message=&gt;&#8221;alphanumeric characters, colons, periods, forward/backward slashes only please&#8221;<br />
end</p>
<p><strong>routes.rb</strong></p>
<p>Rateatrack::Application.routes.draw do</p>
<p>match &#8220;tracks/generate/&#8221; =&gt; &#8220;tracks#generate&#8221; <span style="color: #ff0000;">// custom :action route</span><br />
resources :tracks</p>
<p>get &#8220;home/index&#8221;</p>
<p>root :to =&gt; &#8220;tracks#index&#8221; <span style="color: #ff0000;">// sidestep app index</span><span style="color: #ff0000;">, route to desired controller</span><br />
end</p>
<p><strong>heroku only uses Postgres, used MySQL locally, fun experiment to RELY on persistence:</strong></p>
<p><em>database.yml</em></p>
<p>development:<br />
adapter: mysql2<br />
encoding: utf8<br />
reconnect: false<br />
database: rateatrack_development<br />
pool: 5<br />
username: user_name<br />
password: password_removed<br />
socket: /tmp/mysql.sock</p>
<p>production:<br />
encoding: unicode<br />
adapter: postgresql<br />
database: rateatrack_production</p>
<p><strong>simple schema.rb</strong></p>
<p>ActiveRecord::Schema.define(:version =&gt; 0) do</p>
<p>create_table &#8220;tracks&#8221;, :force =&gt; true do |t|<br />
t.string  &#8220;url&#8221;,     :limit =&gt; 64<br />
t.string  &#8220;title&#8221;,   :limit =&gt; 64<br />
t.string  &#8220;artist&#8221;,  :limit =&gt; 64<br />
t.integer &#8220;length&#8221;<br />
t.decimal &#8220;average&#8221;, :default =&gt; 0.0, :precision =&gt; 8, :scale =&gt; 2<br />
t.integer &#8220;votes&#8221;,   :default =&gt; 0<br />
end</p>
<p>end</p>
<p><strong>RoR version of include, partial, snippet, and so on&#8230;</strong></p>
<p>&lt;%= render &#8216;form&#8217; %&gt;</p>
<p>this will pull from the same folder as the calling resource, file name _form.erb</p>
<p><strong>form example with error checking:</strong></p>
<p>&lt;% @track %&gt;<br />
&lt;%= form_for(@track) do |track_form| %&gt;<br />
&lt;% if @track.errors.any? %&gt;<br />
&lt;%= pluralize(@track.errors.count, &#8220;error&#8221;) %&gt; prohibited this post from being saved:<br />
&lt;% @track.errors.full_messages.each do |msg| %&gt;<br />
&lt;%= msg %&gt;<br />
&lt;% end %&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;<br />
&lt;% end %&gt;<br />
&lt;table&gt;&lt;tr&gt;&lt;th&gt;&lt;%= track_form.label :url %&gt;&lt;/th&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;td&gt;&lt;%= track_form.text_field :url %&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br />
&lt;%= track_form.submit %&gt;<br />
&lt;% end %&gt;</p>
<p><strong>Gemfile</strong></p>
<p>gem &#8216;rails&#8217;, &#8217;3.0.4&#8242;<br />
gem &#8216;mysql2&#8242;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/ruby-on-rails-rateatrack-app-notes-to-self/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails simple authentication</title>
		<link>http://alexyz.com/ruby-on-rails-simple-authentication/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ruby-on-rails-simple-authentication</link>
		<comments>http://alexyz.com/ruby-on-rails-simple-authentication/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 04:25:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1306</guid>
		<description><![CDATA[project/app/controllers/application_controller.rg class ApplicationController &#60; ActionController::Base protect_from_forgery private def authenticate authenticate_or_request_with_http_basic do &#124;user_name, password&#124; user_name == &#8216;admin&#8217; &#38;&#38; password == &#8216;password&#8217; end end end example usage: project/app/controllers/example_controller.rb class TracksController &#60; ApplicationController before_filter :authenticate, :except =&#62; [:index, :show] &#8230; end]]></description>
			<content:encoded><![CDATA[<p><strong>project/app/controllers/application_controller.rg<br />
</strong></p>
<p>class ApplicationController &lt; ActionController::Base<br />
protect_from_forgery</p>
<p>private</p>
<p>def authenticate<br />
authenticate_or_request_with_http_basic do |user_name, password|<br />
user_name == &#8216;admin&#8217; &amp;&amp; password == &#8216;password&#8217;<br />
end<br />
end<br />
end</p>
<p><strong>example usage: project/app/controllers/example_controller.rb</strong></p>
<p>class TracksController &lt; ApplicationController</p>
<p>before_filter :authenticate, :except =&gt; [:index, :show]</p>
<p>&#8230;</p>
<p>end</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/ruby-on-rails-simple-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Rails Application Directory Godaddy Hosting</title>
		<link>http://alexyz.com/create-rails-application-directory-godaddy-hosting/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-rails-application-directory-godaddy-hosting</link>
		<comments>http://alexyz.com/create-rails-application-directory-godaddy-hosting/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 22:11:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Godaddy]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1296</guid>
		<description><![CDATA[If you use 4GH: http://community.godaddy.com/help/article/1091 visit http://www.YOUR-URL-HERE.com/_h_admin_/index.php]]></description>
			<content:encoded><![CDATA[<p>If you use 4GH:</p>
<p><a href="http://community.godaddy.com/help/article/1091">http://community.godaddy.com/help/article/1091</a></p>
<p>visit http://www.YOUR-URL-HERE.com/<strong><strong>_h_admin_/index.php</strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/create-rails-application-directory-godaddy-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails 3 Mac OSX 10.6.6 &#8211; Some Basics</title>
		<link>http://alexyz.com/ruby-on-rails-3-mac-osx-10-6-6-some-basics/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ruby-on-rails-3-mac-osx-10-6-6-some-basics</link>
		<comments>http://alexyz.com/ruby-on-rails-3-mac-osx-10-6-6-some-basics/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 06:52:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1293</guid>
		<description><![CDATA[If you just switched to Rails 3, prepare for some changes&#8230; Need an IDE? http://netbeans.org/downloads/index.html http://www.aptana.com/ Recommended tutorials: http://netbeans.org/kb/docs/ruby/rapid-ruby-weblog.html http://edgeguides.rubyonrails.org/getting_started.html Gems mysql2 problems?: http://stackoverflow.com/questions/3129644/rails-3-mysql-problems New Project: Navigate to the folder where you&#8217;d like to create a new project, terminal: $ rails new projectname Start Server: Navigate to the new project, terminal: $ rails s Create [...]]]></description>
			<content:encoded><![CDATA[<p><strong>If you just switched to Rails 3, prepare for some changes&#8230;</strong></p>
<p><strong></strong><strong>Need an IDE?</strong></p>
<p><a href="http://netbeans.org/downloads/index.html">http://netbeans.org/downloads/index.html</a></p>
<p><a href="http://www.aptana.com/">http://www.aptana.com/</a></p>
<p><strong>Recommended tutorials:</strong></p>
<p><a href="http://netbeans.org/kb/docs/ruby/rapid-ruby-weblog.html">http://netbeans.org/kb/docs/ruby/rapid-ruby-weblog.html</a></p>
<p><a href="http://edgeguides.rubyonrails.org/getting_started.html">http://edgeguides.rubyonrails.org/getting_started.html</a></p>
<p><strong>Gems mysql2 problems?:</strong></p>
<p><a href="http://stackoverflow.com/questions/3129644/rails-3-mysql-problems">http://stackoverflow.com/questions/3129644/rails-3-mysql-problems</a></p>
<p><strong>New Project:</strong></p>
<p>Navigate to the folder where you&#8217;d like to create a new project, terminal:</p>
<p><span style="color: #ff0000;">$ rails new projectname</span></p>
<p><strong>Start Server:</strong></p>
<p>Navigate to the new project, terminal:</p>
<p><span style="color: #ff0000;">$ rails s<br />
</span></p>
<p>Create a database for the new project, terminal (if you have phpMyAdmin simply type name and push Create):</p>
<pre><span style="color: #ff0000;">$ mysqladmin -u root -p create projectname</span>
</pre>
<p><strong>Scaffold example:</strong></p>
<p><span style="color: #ff0000;"><code>$ rails generate scaffold Post name:string title:string content:text</code></span></p>
<p><span style="color: #ff0000;"><strong><span style="color: #000000;">Migrate now (env specific):</span></strong><br />
</span></p>
<pre><span style="color: #ff0000;">$ rake db:migrate RAILS_ENV=production
</span></pre>
<p><strong>link_to example:</strong></p>
<p><span style="color: #ff0000;">&lt;%= link_to &#8220;My Blog&#8221;, posts_path %&gt;</span></p>
<p><strong><span style="color: #ff0000;"><span style="color: #000000;">Console:</span></span></strong></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #ff0000;">$ rails console</span></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #ff0000;"><strong><span style="color: #000000;">Active Record Doc:</span></strong><br />
</span></span></span></p>
<p><a href="http://edgeguides.rubyonrails.org/active_record_querying.html">http://edgeguides.rubyonrails.org/active_record_querying.html</a></p>
<p><strong><span style="color: #ff0000;">Un</span>escaped HTML (escaped now default in 3):</strong></p>
<p><span style="color: #ff0000;">&lt;%= raw post.name %&gt;</span></p>
<p><span style="color: #000000;"><strong>Layout and Rendering:</strong></span></p>
<p><a href="http://edgeguides.rubyonrails.org/layouts_and_rendering.html">http://edgeguides.rubyonrails.org/layouts_and_rendering.html</a></p>
<p><strong>Routing from the Outside In:</strong></p>
<p><a href="http://edgeguides.rubyonrails.org/routing.html">http://edgeguides.rubyonrails.org/routing.html</a></p>
<p><strong>Ruby on Rails Guide:</strong></p>
<p><a href="http://edgeguides.rubyonrails.org/index.html">http://edgeguides.rubyonrails.org/index.html</a></p>
<p><strong>Ruby on Rails Tutorial:</strong></p>
<p><a href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book">http://ruby.railstutorial.org/ruby-on-rails-tutorial-book</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/ruby-on-rails-3-mac-osx-10-6-6-some-basics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress control number of posts per archive page</title>
		<link>http://alexyz.com/wordpress-control-number-of-posts-per-archive-page/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-control-number-of-posts-per-archive-page</link>
		<comments>http://alexyz.com/wordpress-control-number-of-posts-per-archive-page/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 02:03:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1284</guid>
		<description><![CDATA[edit archive.php replace this: &#60; ?php get_header(); ? &#62; with something along these lines: &#60; ?php get_header(); ? &#62; &#60; ?php $paged = (get_query_var(&#8216;paged&#8217;)) ? get_query_var(&#8216;paged&#8217;) : 1; $args=array( &#8216;showposts&#8217; =&#62; 10, &#8216;paged&#8217;=&#62;$paged, &#8216;caller_get_posts&#8217;=&#62; 1 ); query_posts($args); ? &#62;]]></description>
			<content:encoded><![CDATA[<p>edit archive.php</p>
<p>replace this:</p>
<p>&lt; ?php get_header(); ? &gt;</p>
<p>with something along these lines:</p>
<p>&lt; ?php get_header(); ? &gt;<br />
&lt; ?php<br />
$paged = (get_query_var(&#8216;paged&#8217;)) ? get_query_var(&#8216;paged&#8217;) : 1;<br />
$args=array(<br />
&#8216;showposts&#8217; =&gt; 10,<br />
&#8216;paged&#8217;=&gt;$paged,<br />
&#8216;caller_get_posts&#8217;=&gt; 1<br />
);<br />
query_posts($args);<br />
? &gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-control-number-of-posts-per-archive-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl valid email regular expression</title>
		<link>http://alexyz.com/perl-valid-email-regular-expression/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=perl-valid-email-regular-expression</link>
		<comments>http://alexyz.com/perl-valid-email-regular-expression/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:23:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1213</guid>
		<description><![CDATA[# Check for valid email address / ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$ /]]></description>
			<content:encoded><![CDATA[<p># Check for valid email address</p>
<p>/<br />
^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$<br />
/</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/perl-valid-email-regular-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS !important override</title>
		<link>http://alexyz.com/css-important-override/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-important-override</link>
		<comments>http://alexyz.com/css-important-override/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:23:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1211</guid>
		<description><![CDATA[A rule that has the !important property will always be applied no matter where that rule appears in the CSS document. example: p { color: #ff0000 !important; }]]></description>
			<content:encoded><![CDATA[<p>A rule that has the !important property will always be applied no matter where that rule appears in the CSS document.</p>
<p>example:</p>
<p>p { color: #ff0000 !important; }</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/css-important-override/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS text-transform</title>
		<link>http://alexyz.com/css-text-transform/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-text-transform</link>
		<comments>http://alexyz.com/css-text-transform/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:22:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1209</guid>
		<description><![CDATA[{text-transform:uppercase} {text-transform:capitalize} {text-transform:lowercase} also consider: {font-variant:small-caps}]]></description>
			<content:encoded><![CDATA[<p>{text-transform:uppercase}<br />
{text-transform:capitalize}<br />
{text-transform:lowercase}</p>
<p>also consider:<br />
{font-variant:small-caps}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/css-text-transform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS pseudo elements &amp; pseudo classes</title>
		<link>http://alexyz.com/css-pseudo-elements-pseudo-classes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-pseudo-elements-pseudo-classes</link>
		<comments>http://alexyz.com/css-pseudo-elements-pseudo-classes/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:21:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1207</guid>
		<description><![CDATA[CSS Pseudo Elements :after Adds content after an element :before Adds content before an element :first-letter Adds a style to the first character of a text :first-line Adds a style to the first line of a text example: h1:after { content:url(smiley.gif); } Posted on 5 Oct 2009, 17:00 &#8211; Category: CSS Comments &#8211; Edit &#8211; [...]]]></description>
			<content:encoded><![CDATA[<h3>CSS Pseudo Elements</h3>
<p>:after<br />
Adds content after an element</p>
<p>:before<br />
Adds content before an element</p>
<p>:first-letter<br />
Adds a style to the first character of a text</p>
<p>:first-line<br />
Adds a style to the first line of a text</p>
<p>example:<br />
h1:after<br />
{<br />
content:url(smiley.gif);<br />
}</p>
<p><em>Posted on 5 Oct 2009, 17:00 &#8211; Category: <a href="http://www.alexyz.com/cuealex/pplog.pl?viewCat=CSS">CSS</a><br />
<a href="http://www.alexyz.com/cuealex/pplog.pl?viewDetailed=00100">Comments</a> &#8211; <a href="http://www.alexyz.com/cuealex/pplog.pl?edit=00100">Edit</a> &#8211; <a href="http://www.alexyz.com/cuealex/pplog.pl?delete=00100">Delete</a></em></p>
<h3>Pseudo Classes</h3>
<p>:active<br />
Adds a style to an element that is activated</p>
<p>:first-child<br />
Adds a style to an element that is the first child of another element</p>
<p>:focus<br />
Adds a style to an element that has keyboard input focus</p>
<p>:hover<br />
Adds a style to an element when you mouse over it</p>
<p>:lang<br />
Adds a style to an element with a specific lang attribute</p>
<p>:link<br />
Adds a style to an unvisited link</p>
<p>:visited<br />
Adds a style to a visited link</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/css-pseudo-elements-pseudo-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS em</title>
		<link>http://alexyz.com/css-em/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-em</link>
		<comments>http://alexyz.com/css-em/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:18:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1204</guid>
		<description><![CDATA[pixels/16=em example: h1 {font-size:2.5em} /* 40px/16=2.5em */ h2 {font-size:1.875em} /* 30px/16=1.875em */ p {font-size:0.875em} /* 14px/16=0.875em */]]></description>
			<content:encoded><![CDATA[<p>pixels/16=em<br />
example:<br />
h1 {font-size:2.5em} /* 40px/16=2.5em */<br />
h2 {font-size:1.875em} /* 30px/16=1.875em */<br />
p {font-size:0.875em} /* 14px/16=0.875em */</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/css-em/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl string substitution substr</title>
		<link>http://alexyz.com/perl-string-substitution-substr/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=perl-string-substitution-substr</link>
		<comments>http://alexyz.com/perl-string-substitution-substr/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:16:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1202</guid>
		<description><![CDATA[example: my $text = &#8220;This is one heck of a story&#8221;; my $swap = &#8220;heck&#8221;; my $replacement = &#8220;hell&#8221;; substr($text, index($text, $swap), length($swap), $replacement); print $text;]]></description>
			<content:encoded><![CDATA[<p>example:</p>
<p>my $text = &#8220;This is one heck of a story&#8221;;</p>
<p>my $swap = &#8220;heck&#8221;;</p>
<p>my $replacement = &#8220;hell&#8221;;</p>
<p>substr($text, index($text, $swap), length($swap), $replacement);</p>
<p>print $text;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/perl-string-substitution-substr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl chop chomp</title>
		<link>http://alexyz.com/perl-chop-chomp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=perl-chop-chomp</link>
		<comments>http://alexyz.com/perl-chop-chomp/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:14:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1200</guid>
		<description><![CDATA[sub spacer { print &#8220;&#60;br /&#62;&#8221;; } my $text = &#8220;This is one heck of a story&#8221;; # remove the last character print chop($text); spacer(); # returns y print $text; spacer(); # we can see that it also DID alter the variable # remove newlines from the end of a string only $text = $text [...]]]></description>
			<content:encoded><![CDATA[<p>sub spacer</p>
<p>{ print &#8220;&lt;br /&gt;&#8221;; }</p>
<p>my $text = &#8220;This is one heck of a story&#8221;;</p>
<p># remove the last character</p>
<p>print chop($text); spacer(); # returns y</p>
<p>print $text; spacer(); # we can see that it also DID alter the variable</p>
<p># remove newlines from the end of a string only</p>
<p>$text = $text . &#8220;\n\n&#8221;;</p>
<p>print $text; spacer();</p>
<p>print chomp($text); spacer(); # again, returns # of items &#8220;chomp&#8221;ed <img src='http://alexyz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>print $text; spacer();</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/perl-chop-chomp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl output pretty HTML</title>
		<link>http://alexyz.com/perl-output-pretty-html/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=perl-output-pretty-html</link>
		<comments>http://alexyz.com/perl-output-pretty-html/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:11:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1198</guid>
		<description><![CDATA[# outputting pretty HTML # basically a matter of including \n # and using Perl qq function my (@time,@days,@months,$time,$days,$months); @time = localtime; @days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); @months = qw(January February March April May June July August September October November December); print qq(\n&#60;html&#62;\n&#60;head&#62;\n&#60;title&#62;Get the date&#60;/title&#62;\n&#60;/head&#62;\n&#60;body&#62;\n); print qq(Today is &#60;strong&#62;$days[$time[6]], $months[$time[4]] $time[3]&#60;/strong&#62;.); [...]]]></description>
			<content:encoded><![CDATA[<p># outputting pretty HTML</p>
<p># basically a matter of including \n<br />
# and using Perl qq function</p>
<p>my (@time,@days,@months,$time,$days,$months);</p>
<p>@time = localtime;</p>
<p>@days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);</p>
<p>@months = qw(January February March April May June July August September October November December);</p>
<p>print qq(\n&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;Get the date&lt;/title&gt;\n&lt;/head&gt;\n&lt;body&gt;\n);</p>
<p>print qq(Today is &lt;strong&gt;$days[$time[6]], $months[$time[4]] $time[3]&lt;/strong&gt;.);</p>
<p>print &#8220;\n&lt;/body&gt;\n&#8221;;</p>
<p>print &#8216;&lt;/html&gt;&#8217;;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/perl-output-pretty-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Setting up your system to Bake</title>
		<link>http://alexyz.com/cakephp-setting-up-your-system-to-bake/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cakephp-setting-up-your-system-to-bake</link>
		<comments>http://alexyz.com/cakephp-setting-up-your-system-to-bake/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:10:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1195</guid>
		<description><![CDATA[http://i.justrealized.com/2009/02/16/how-to-run-xampps-php-cli-and-cakephp-console/ start baking: C:\xampp\htdocs\project\app&#62;&#8221;../cake/console/cake&#8221; bake]]></description>
			<content:encoded><![CDATA[<p><a href="http://i.justrealized.com/2009/02/16/how-to-run-xampps-php-cli-and-cakephp-console/" target="_blank">http://i.justrealized.com/2009/02/16/how-to-run-xampps-php-cli-and-cakephp-console/</a><br />
start baking:</p>
<p><strong>C:\xampp\htdocs\project\app&gt;&#8221;../cake/console/cake&#8221; bake</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/cakephp-setting-up-your-system-to-bake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting a new project with CakePHP</title>
		<link>http://alexyz.com/starting-a-new-project-with-cakephp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=starting-a-new-project-with-cakephp</link>
		<comments>http://alexyz.com/starting-a-new-project-with-cakephp/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:09:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1193</guid>
		<description><![CDATA[download the current release: cakephp.org unzip, copy/rename folder as desired check apache file permissions app/tmp &#8211; 0777 app/config core.php &#8211; change Security.salt to new value database.php.default &#8211; remove .default, and configure values according to your database done]]></description>
			<content:encoded><![CDATA[<p>download the current release:</p>
<p>cakephp.org</p>
<p>unzip, copy/rename folder as desired</p>
<p>check apache file permissions<br />
app/tmp &#8211; 0777</p>
<p>app/config<br />
core.php &#8211; change Security.salt to new value<br />
database.php.default &#8211; remove .default, and configure values according to your database</p>
<p>done</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/starting-a-new-project-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP naming conventions</title>
		<link>http://alexyz.com/cakephp-naming-conventions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cakephp-naming-conventions</link>
		<comments>http://alexyz.com/cakephp-naming-conventions/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:08:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1191</guid>
		<description><![CDATA[URL will trigger controller example: http://appname.com/data_users in app/controllers: data_users_controller.php in there: class DataUsersController extends Controller { } this should be the same as the table it will reference: data_users in app/models: data_user.php class data_user extends AppModel { } in app/views/data_users: function.ctp]]></description>
			<content:encoded><![CDATA[<p>URL will trigger controller<br />
example:</p>
<p>http://appname.com/data_users</p>
<p>in app/controllers:<br />
data_users_controller.php<br />
in there:<br />
class DataUsersController extends Controller {<br />
}</p>
<p>this should be the same as the table it will reference:<br />
data_users</p>
<p>in app/models:<br />
data_user.php<br />
class data_user extends AppModel {<br />
}</p>
<p>in app/views/data_users:<br />
function.ctp</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/cakephp-naming-conventions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Git Heroku Terminal command notes</title>
		<link>http://alexyz.com/rails-git-heroku-command-notes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rails-git-heroku-command-notes</link>
		<comments>http://alexyz.com/rails-git-heroku-command-notes/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 03:50:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Heroku]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1299</guid>
		<description><![CDATA[first cd to the project directory: git init git add . git commit master heroku create &#8220;NewApplicationName&#8221; git push heroku master heroku rake db:schema:load rake db:schema:dump (handy to dump local db if you&#8217;ve been modifying it w/o migrations&#8230;) heroku rake db:migrate]]></description>
			<content:encoded><![CDATA[<p>first cd to the project directory:</p>
<p>git init</p>
<p><strong>git add .</strong></p>
<p>git commit master</p>
<p>heroku create &#8220;NewApplicationName&#8221;</p>
<p>git push heroku master</p>
<p>heroku rake db:schema:load</p>
<p>rake db:schema:dump (handy to dump local db if you&#8217;ve been modifying it w/o migrations&#8230;)</p>
<p>heroku rake db:migrate</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/rails-git-heroku-command-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress affect categories search form searches &#8211; solution 2</title>
		<link>http://alexyz.com/wordpress-affect-categories-search-form-searches-solution-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-affect-categories-search-form-searches-solution-2</link>
		<comments>http://alexyz.com/wordpress-affect-categories-search-form-searches-solution-2/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 23:39:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1051</guid>
		<description><![CDATA[Please see this post if you&#8217;re only wanting to limit the form to a single category, as it&#8217;s as simple as adding a hidden form field. This solution uses functions.php, adding something like the following: function SearchFilter($query) { if($query-&#62;is_search){ $query-&#62;set(&#8216;cat&#8217;,&#8217;0&#8242;); } } add_filter(&#8216;pre_get_posts&#8217;,'SearchFilter&#8217;); similar post: http://alexyz.com/wordpress-rss-feed-exclude-categories-or-only-serve-one-particular-category/ http://alexyz.com/wordpress-limit-search-form-to-a-category-2/ similar reference: http://speckyboy.com/2010/09/19/10-useful-wordpress-search-code-snippets/]]></description>
			<content:encoded><![CDATA[<p>Please see <a href="http://alexyz.com/wordpress-limit-search-form-to-a-category-2/">this post</a> if you&#8217;re only wanting to limit the form to a single category, as it&#8217;s as simple as adding a hidden form field.</p>
<p>This solution uses <span style="color: #ff0000;">functions.php</span>, adding something like the following:</p>
<p><span style="color: #ff0000;">function SearchFilter($query)<br />
{<br />
if($query-&gt;is_search){<br />
$query-&gt;set(&#8216;cat&#8217;,&#8217;0&#8242;);<br />
}<br />
}<br />
add_filter(&#8216;pre_get_posts&#8217;,'SearchFilter&#8217;);</span></p>
<p><span style="color: #000000;">similar post:</span><br />
<a href="http://alexyz.com/wordpress-rss-feed-exclude-categories-or-only-serve-one-particular-category/">http://alexyz.com/wordpress-rss-feed-exclude-categories-or-only-serve-one-particular-category/</a></p>
<p><a href="http://alexyz.com/wordpress-limit-search-form-to-a-category-2/">http://alexyz.com/wordpress-limit-search-form-to-a-category-2/</a></p>
<p>similar reference:</p>
<p><a href="http://speckyboy.com/2010/09/19/10-useful-wordpress-search-code-snippets/">http://speckyboy.com/2010/09/19/10-useful-wordpress-search-code-snippets/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-affect-categories-search-form-searches-solution-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Visitor</title>
		<link>http://alexyz.com/design-patterns-reference-visitor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-visitor</link>
		<comments>http://alexyz.com/design-patterns-reference-visitor/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 03:48:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1006</guid>
		<description><![CDATA[&#8220;The Visitor Design Pattern constructs distinct objects containing an algorithm that, when consumed by a parent object in a standard way, apply that algorithm to the parent object.&#8221; &#160; class CD { public $band; public $title; public $price; &#160; public function __construct($band, $title, $price) { $this-&#62;band = $band; $this-&#62;title = $title; $this-&#62;price = $price; } [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Visitor Design Pattern constructs distinct objects containing an algorithm that, when consumed by a parent object in a standard way, apply that algorithm to the parent object.&#8221;</p>
<p>&nbsp;</p>
<p>class CD<br />
<span style="color: #ff0000;">{</span><br />
public $band;<br />
public $title;<br />
public $price;</p>
<p>&nbsp;</p>
<p>public function __construct($band, $title, $price)<br />
{<br />
$this-&gt;band = $band;<br />
$this-&gt;title = $title;<br />
$this-&gt;price = $price;<br />
}</p>
<p>&nbsp;</p>
<p>public function buy()<br />
{<br />
// stub<br />
}</p>
<p>&nbsp;</p>
<p>public function <span style="color: #0000ff;">acceptVisitor($visitor)</span><br />
{<br />
$visitor-&gt;visitCD($this);<br />
}<br />
<span style="color: #ff0000;">}</span></p>
<p>&nbsp;</p>
<p>class CDVisitorLogPurchase<br />
<span style="color: #ff0000;">{</span><br />
public function visitCD($cd)<br />
{<br />
$logline = &#8220;{$cd-&gt;title} by {$cd-&gt;band} was purchased for {$cd-&gt;price} &#8220;;<br />
$logline .= &#8220;at &#8221; . sdate(&#8216;r&#8217;) . &#8220;\n&#8221;;</p>
<p>&nbsp;</p>
<p>file_put_contents(&#8216;/logs/purchases.log&#8217;, $logline, FILE_APPEND);<br />
}<br />
<span style="color: #ff0000;">}</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// usage</span><br />
$externalBand = &#8216;Never Again&#8217;;<br />
$externalTitle = &#8216;Waste of a Rib&#8217;;<br />
$externalPrice = 9.99;</p>
<p>&nbsp;</p>
<p>$cd = new CD($externalBand, $externalTitle, $externalPrice);<br />
$cd-&gt;buy();<br />
$cd-&gt;<span style="color: #0000ff;">acceptVisitor(new CDVisitorLogPurchase())</span>;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// adding a new Visitor to accomplish a new functionality is straight forward</span><br />
class CDVisitorPopulateDiscountList<br />
<span style="color: #ff0000;">{</span><br />
public function visitCD($cd)<br />
{<br />
if ($cd-&gt;price &lt; 10)<br />
{<br />
$this-&gt;_populateDiscountList($cd);<br />
}<br />
<span style="color: #333333;">}</span></p>
<p>&nbsp;</p>
<p>protected function _populateDiscountList($cd)<br />
{<br />
<span style="color: #ff0000;">// stub connects to sqlite and logs etc&#8230;</span><br />
}<br />
<span style="color: #ff0000;">}</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// again, usage</span><br />
$cd = new CD($externalBand, $externalTitle, $externalPrice);<br />
$cd-&gt;buy();<br />
$cd-&gt;<span style="color: #0000ff;">acceptVisitor(new CDVisitorLogPurchase())</span>;<br />
$cd-&gt;<span style="color: #0000ff;">acceptVisitor(new CDVisitorPopulateDiscountList())</span>;</p>
<p>&nbsp;</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-visitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress creating users in MySQL via script wp_user_level wp_capabilities wp_users</title>
		<link>http://alexyz.com/wordpress-creating-users-in-mysql-via-script-wp_user_level-wp_capabilities-wp_users/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-creating-users-in-mysql-via-script-wp_user_level-wp_capabilities-wp_users</link>
		<comments>http://alexyz.com/wordpress-creating-users-in-mysql-via-script-wp_user_level-wp_capabilities-wp_users/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 22:16:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=1000</guid>
		<description><![CDATA[Scenario: Creating a WordPress blog with an entire company of users. We want employees to already have an account, so that registration may be turned OFF otherwise. From an excel list of employees, we&#8217;ll extract their email, make an account for each email in the WordPress database, and then they may change their passwords themselves. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Scenario:</strong><br />
Creating a WordPress blog with an entire company of users.<br />
We want employees to already have an account, so that registration may be turned OFF otherwise.<br />
From an excel list of employees, we&#8217;ll extract their email, make an account for each email in the WordPress database, and then they may change their passwords themselves.  You can imagine what the php script will look like, to extract the email, and foreach insert the following (uniqueusername and 5 replaced of course with incrementing id numbers and changing emailnames@ourcompany.com):</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">INSERT INTO wp_users<br />
(id,user_login,user_pass,user_email,display_name)<br />
VALUES<br />
(&#8217;5&#8242;,&#8217;uniqueusername&#8217;,md5(&#8216;pass&#8217;),&#8217;uniqueusername@ourcompany.com&#8217;,'uniqueusername&#8217;);</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// to note, this below is simultaneously a nice example of how to insert multiple rows with one MySQL INSERT statement</span></p>
<p>&nbsp;</p>
<p><span style="color: #008000;">INSERT INTO wp_usermeta<br />
(user_id,meta_key,meta_value)<br />
VALUES<br />
(&#8217;5&#8242;,&#8217;wp_capabilities&#8217;,'a:1:{s:6:&#8221;author&#8221;;s:1:&#8221;1&#8243;;}&#8217;),<br />
(&#8217;5&#8242;,&#8217;wp_user_level&#8217;,&#8217;10&#8242;);</span></p>
<p>&nbsp;</p>
<p><strong>Thus, the full script looks something like this:</strong></p>
<p>&nbsp;</p>
<p>$employees = array(&#8216;employee1@somesite.com&#8217;,'employee2@somesite.com&#8217;,'employee3@somesite.com&#8217;,'andsoon&#8230;&#8217;);</p>
<p>&nbsp;</p>
<p>$startNumber = 10; <span style="color: #ff0000;">// if you already have users, pick the next highest number, as it uses this for several tables below, we need them to happen at the same time so that attributes belong to specific users&#8230;</span></p>
<p>&nbsp;</p>
<p>$db_name = &#8220;databasename&#8221;;<br />
$db_host = &#8220;localhost&#8221;;<br />
$db_username = &#8220;username&#8221;;<br />
$db_password = &#8220;password&#8221;;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// note the nice error reporting so that we can troubleshoot connections, users, table selections, and so forth&#8230;</span><br />
$link = <span style="color: #ff0000;">mysql_connect</span>($db_host, $db_username, $db_password);<br />
if (!$link) {<br />
die(&#8216;Could not connect: &#8216; . mysql_error());<br />
}<br />
else<br />
{<br />
echo &#8216;Connected successfully&lt;br /&gt;&#8217;;<br />
}</p>
<p>&nbsp;</p>
<p>$db_selected = <span style="color: #ff0000;">mysql_select_db</span>($db_name, $link);<br />
if (!$db_selected) {<br />
die (&#8216;Can\&#8217;t use foo : &#8216; . <span style="color: #ff0000;">mysql_error()</span>);<br />
}<br />
else<br />
{<br />
echo &#8216;Selected manyvoices database successfully&lt;br /&gt;&#8217;;<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">foreach</span>($employees as $employee)<br />
{<br />
list($user_name, $therest) = <span style="color: #ff0000;">explode</span>(&#8216;@&#8217;,$employee);</p>
<p>&nbsp;</p>
<p>$query1 = &#8220;<span style="color: #ff0000;">INSERT INTO wp_users<br />
(id,user_login,user_pass,user_email,display_name)<br />
VALUES<br />
(&#8216;&#8221; . $startNumber . &#8220;&#8216;,&#8217;&#8221; . $user_name . &#8220;&#8216;,md5(&#8216;pass&#8217;),&#8217;&#8221; . $employee . &#8220;&#8216;,&#8217;&#8221; . $user_name . &#8220;&#8216;)</span>&#8220;;<br />
//echo $query1 . &#8220;&lt;br /&gt;&#8221;;</p>
<p>&nbsp;</p>
<p>$result1 = <span style="color: #ff0000;">mysql_query</span>($query1);<br />
if(!result1){<br />
die(&#8216;Error: &#8216; . <span style="color: #ff0000;">mysql_error()</span>);<br />
}<br />
else{<br />
echo &#8220;User: &#8221; . $user_name . &#8221; : Added&lt;br /&gt;&#8221;;<br />
}</p>
<p>&nbsp;</p>
<p>$query2 = &#8220;<span style="color: #ff0000;">INSERT INTO wp_usermeta<br />
(user_id,meta_key,meta_value)<br />
VALUES<br />
(&#8216;&#8221; . $startNumber . &#8220;&#8216;,&#8217;wp_capabilities&#8217;,'a:1:{s:6:\&#8221;author\&#8221;;s:1:\&#8221;1\&#8221;;}&#8217;),<br />
(&#8216;&#8221; . $startNumber . &#8220;&#8216;,&#8217;wp_user_level&#8217;,&#8217;10&#8242;)</span>&#8220;;<br />
//echo $query2 . &#8220;&lt;br /&gt;&#8221;;</p>
<p>&nbsp;</p>
<p>$result2 = <span style="color: #ff0000;">mysql_query</span>($query2);<br />
if(!result2){<br />
die(&#8216;Error: &#8216; . <span style="color: #ff0000;">mysql_error()</span>);<br />
}<br />
else<br />
{<br />
echo &#8220;User Credentials: &#8221; . $user_name . &#8221; : Updated&lt;br /&gt;&#8221;;<br />
}</p>
<p>&nbsp;</p>
<p>$startNumber++;<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">mysql_close</span>($link);</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-creating-users-in-mysql-via-script-wp_user_level-wp_capabilities-wp_users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Template</title>
		<link>http://alexyz.com/design-patterns-reference-template/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-template</link>
		<comments>http://alexyz.com/design-patterns-reference-template/#comments</comments>
		<pubDate>Fri, 31 Dec 2010 03:48:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=979</guid>
		<description><![CDATA[&#8220;The Template Design Pattern creates an abstract object that enforces a set of methods and functionality that will be used in common by child classes as a template for their own design.&#8221; &#160; abstract class SaleItemTemplate { public $price = 0; &#160; public final function setPriceAdjustments() { $this-&#62;price += $this-&#62;taxAddition(); $this-&#62;price += $this-&#62;oversizedAddition(); } &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Template Design Pattern creates an abstract object that enforces a set of methods and functionality that will be used in common by child classes as a template for their own design.&#8221;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">abstract</span> class SaleItemTemplate<br />
<span style="color: #0000ff;">{</span><br />
public $price = 0;</p>
<p>&nbsp;</p>
<p>public <span style="color: #ff0000;">final </span>function setPriceAdjustments()<br />
{<br />
$this-&gt;price += $this-&gt;taxAddition();<br />
$this-&gt;price += $this-&gt;oversizedAddition();<br />
}</p>
<p>&nbsp;</p>
<p>protected function oversizedAddition()<br />
{<br />
return 0;<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">abstract</span> protected function taxAddition();<br />
<span style="color: #0000ff;">}</span></p>
<p>&nbsp;</p>
<p>class CD <span style="color: #ff0000;">extends</span> SaleItemTemplate<br />
<span style="color: #0000ff;">{</span><br />
public $band;<br />
public $title;</p>
<p>&nbsp;</p>
<p>public function __construct($band, $title, $price)<br />
{<br />
$this-&gt;band = $band;<br />
$this-&gt;title = $title;<br />
$this-&gt;price = $price;<br />
}</p>
<p>&nbsp;</p>
<p>protected function taxAddition()<br />
{<br />
return round($this-&gt;price * .05, 2);<br />
}<br />
<span style="color: #0000ff;">}</span></p>
<p>&nbsp;</p>
<p>class BandEndorsedCaseOfCerial <span style="color: #ff0000;">extends </span>SaleItemTemplate<br />
<span style="color: #0000ff;">{</span><br />
public $band;</p>
<p>&nbsp;</p>
<p>public function __construct($band, $price)<br />
{<br />
$this-&gt;band = $band;<br />
$this-&gt;price = $price;<br />
}</p>
<p>&nbsp;</p>
<p>protected function taxAddition()<br />
{<br />
return 0;<br />
}</p>
<p>&nbsp;</p>
<p>protected function oversizedAddition()<br />
{<br />
return round($this-&gt;price * .20, 2);<br />
}<br />
<span style="color: #0000ff;">}</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// use</span><br />
$externalTitle = &#8220;Waste of a Rib&#8221;;<br />
$externalBand = &#8220;Never Again&#8221;;<br />
$externalCDPrice = 12.99;<br />
$externalCerealPrice = 90;<br />
$cd = new CD($externalBand, $exteralTitle, $externalCDPrice);<br />
$cd-&gt;setPriceAdjustments();</p>
<p>&nbsp;</p>
<p>print &#8216;The total cost for CD item is: $&#8217; . $cd-&gt;price;</p>
<p>&nbsp;</p>
<p>$cereal = new BandEndorsedCaseOfCerial($externalBand, $externalCerealPrice);<br />
$cereal-&gt;setPriceAdjustments();</p>
<p>&nbsp;</p>
<p>print &#8216;The total cost for the Cereal case is: $&#8217; . $cereal-&gt;price;</p>
<p>&nbsp;</p>
<p>&#8220;When creating an object where the general steps of a design are defined but the actual logic is left to be detailed by a child class, using the Template Design Pattern is best practice.&#8221;</p>
<p>&nbsp;</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Strategy</title>
		<link>http://alexyz.com/design-patterns-reference-strategy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-strategy</link>
		<comments>http://alexyz.com/design-patterns-reference-strategy/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 02:33:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=951</guid>
		<description><![CDATA["The Strategy Design Pattern helps architect an object that can make use of algorithms in other objects on demand in lieu of containing the logic itself."
<p>&#160;</p>
class <span style="color: #0000ff;">CDusesStrategy</span>
<span style="color: #0000ff;">{</span>
<span style="color: #008000;">public</span> $title = '';
<span style="color: #008000;">public</span> $band = '';
<p>&#160;</p>
protected $_strategy;
<p>&#160;</p>
public function __construct($title, $band)]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Strategy Design Pattern helps architect an object that can make use of algorithms in other objects on demand in lieu of containing the logic itself.&#8221;</p>
<p>&nbsp;</p>
<p>class <span style="color: #0000ff;">CDusesStrategy</span><br />
<span style="color: #0000ff;">{</span><br />
<span style="color: #008000;">public</span> $title = &#8221;;<br />
<span style="color: #008000;">public</span> $band = &#8221;;</p>
<p>&nbsp;</p>
<p>protected $_strategy;</p>
<p>&nbsp;</p>
<p>public function __construct($title, $band)<br />
{<br />
$this-&gt;title = $title;<br />
$this-&gt;band = $band;<br />
}</p>
<p>&nbsp;</p>
<p>public function setStrategyContext($strategyObject)<br />
{<br />
$this-&gt;_strategy = $strategyObject;<br />
}</p>
<p>&nbsp;</p>
<p>public function get()<br />
{<br />
<span style="color: #008000;">return </span>$this-&gt;_strategy-&gt;get($this);<br />
}<br />
<span style="color: #0000ff;">}</span></p>
<p>&nbsp;</p>
<p>class <span style="color: #0000ff;">CDAsXMLStrategy</span><br />
<span style="color: #0000ff;">{</span><br />
public function get(<span style="color: #0000ff;">CDusesStrategy</span> $cd)<br />
{<br />
$doc = new DomDocument();<br />
$root = $doc-&gt;createElement(&#8216;CD&#8217;);<br />
$root = $doc-&gt;appendChild($root);<br />
$title = $doc-&gt;createElement(&#8216;TITLE&#8217;, $cd-&gt;title);<br />
$title = $root-&gt;appendChild($title);<br />
$band = $root-&gt;createElement(&#8216;BAND&#8217;, $cd-&gt;band);<br />
$band = $root-&gt;appendChild($band);</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">return</span> $doc-&gt;saveXML();<br />
}<br />
<span style="color: #0000ff;">}</span></p>
<p>&nbsp;</p>
<p>class <span style="color: #0000ff;">CDAsJSONStrategy</span><br />
<span style="color: #0000ff;">{</span><br />
public function get(<span style="color: #0000ff;">CDusesStrategy</span> $cd)<br />
{<br />
$json = array();<br />
$json['CD']['title'] = $cd-&gt;title;<br />
$json['CD']['band'] = $cd-&gt;band;</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">return</span> json_encode($json);<br />
}<br />
<span style="color: #0000ff;">}</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// usage</span><br />
$cd = <span style="color: #008000;">new</span> <span style="color: #0000ff;">CDusesStrategy</span>($externalTitle, $externalBand);</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// xml output</span><br />
$cd-&gt;setStrategyContext(new <span style="color: #0000ff;">CDAsXMLStrategy</span>());<br />
<span style="color: #008000;">print</span> $cd-&gt;get();</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// json output</span><br />
$cd-&gt;setStrategyContext(new <span style="color: #0000ff;">CDAsJSONStrategy</span>());<br />
<span style="color: #008000;">print</span> $cd-&gt;get($cd);</p>
<p>&nbsp;</p>
<p>&#8220;When it&#8217;s possible to create interchangeable objects made of self-contained algorithms to be applied to a base object, it is best practice to use the Strategy Design Pattern&#8221;</p>
<p>&nbsp;</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-strategy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snippets: HTML object swf embed within a WordPress post snag it n&#8217; publish it code excerpt</title>
		<link>http://alexyz.com/snippets-html-object-swf-embed-within-a-wordpress-post-snag-it-n-publish-it-code-excerpt/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=snippets-html-object-swf-embed-within-a-wordpress-post-snag-it-n-publish-it-code-excerpt</link>
		<comments>http://alexyz.com/snippets-html-object-swf-embed-within-a-wordpress-post-snag-it-n-publish-it-code-excerpt/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 23:58:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=947</guid>
		<description><![CDATA[&#60;object height=&#8221;24&#8243; width=&#8221;500&#8243; codebase=&#8221;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&#8243; classid=&#8221;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&#8243;&#62;&#60;param value=&#8221;file=http://www.site.net/track.mp3&#38;amp;image=http://www.site.net/trackImage.jpg&#8221; name=&#8221;flashvars&#8221;&#62;&#60;param value=&#8221;http://www.site.com/swf/player.swf&#8221; name=&#8221;movie&#8221;&#62;&#60;embed height=&#8221;24&#8243; width=&#8221;500&#8243; flashvars=&#8221;file=http://www.site.net/track.mp3&#8243; pluginspage=&#8221;http://www.macromedia.com/go/getflashplayer&#8221; type=&#8221;application/x-shockwave-flash&#8221; src=&#8221;http://www.site.com/swf/player.swf&#8221;&#62;&#60;/object&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;object height=&#8221;24&#8243; width=&#8221;500&#8243; codebase=&#8221;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&#8243; classid=&#8221;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&#8243;&gt;&lt;param value=&#8221;file=http://www.site.net/track.mp3&amp;amp;image=http://www.site.net/trackImage.jpg&#8221; name=&#8221;flashvars&#8221;&gt;&lt;param value=&#8221;http://www.site.com/swf/player.swf&#8221; name=&#8221;movie&#8221;&gt;&lt;embed height=&#8221;24&#8243; width=&#8221;500&#8243; flashvars=&#8221;file=http://www.site.net/track.mp3&#8243; pluginspage=&#8221;http://www.macromedia.com/go/getflashplayer&#8221; type=&#8221;application/x-shockwave-flash&#8221; src=&#8221;http://www.site.com/swf/player.swf&#8221;&gt;&lt;/object&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/snippets-html-object-swf-embed-within-a-wordpress-post-snag-it-n-publish-it-code-excerpt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>output XML with PHP (here loaded by Flash)</title>
		<link>http://alexyz.com/output-xml-with-php-here-loaded-by-flash/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=output-xml-with-php-here-loaded-by-flash</link>
		<comments>http://alexyz.com/output-xml-with-php-here-loaded-by-flash/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 19:00:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=935</guid>
		<description><![CDATA[using something like this in Flash AS perhaps? playlist.load(&#8220;http://www.site.com/playlist.xml&#8221;); wish it were this instead? playlist.load(&#8220;http://www.site.com/playlist.php&#8221;); instead of something like this in xml thus that must be updated&#8230;: &#60;songs&#62;&#60;song file=&#8217;http://www.site.com/songs/1.mp3&#8242;  /&#62; &#60;song file=&#8217;http://www.site.com/songs/2.mp3&#8242; /&#62;&#60;/songs&#62; you could have something like this, that updates the output xml file each time a new file is added to the songs [...]]]></description>
			<content:encoded><![CDATA[<p>using something like this in Flash AS perhaps?</p>
<p><span style="color: #ff0000;">playlist.load(&#8220;http://www.site.com/playlist.xml&#8221;);</span></p>
<p>wish it were this instead?</p>
<p><span style="color: #ff0000;">playlist.load(&#8220;http://www.site.com/playlist.php&#8221;);</span></p>
<p>instead of something like this in xml thus that must be updated&#8230;:</p>
<p><span style="color: #0000ff;">&lt;songs&gt;&lt;song file=&#8217;http://www.site.com/songs/1.mp3&#8242;  /&gt;<br />
&lt;song file=&#8217;http://www.site.com/songs/2.mp3&#8242; /&gt;&lt;/songs&gt;</span></p>
<p>you could have something like this, that updates the output xml file each time a new file is added to the songs directory:</p>
<p><span style="color: #ff0000;">&lt; ? p h p</span></p>
<p><span style="color: #ff0000;">header(&#8216;Content-type:text/xml; charset=utf-8&#8242;);<br />
echo &#8220;&lt;songs&gt;&#8221;;</span></p>
<p><span style="color: #ff0000;">if ($handle = opendir(&#8216;../songs&#8217;)) {<br />
while (false !== ($file = readdir($handle))) {<br />
if ($file != &#8220;.&#8221; &amp;&amp; $file != &#8220;..&#8221;) {<br />
//echo &#8220;$file\n&#8221;;<br />
$file_no_extension = implode(&#8216;.&#8217;, explode(&#8216;.&#8217;, $file, -1));<br />
echo &#8220;&lt;song name=&#8217; &#8221; . $file_no_extension . &#8221; &#8216; file=&#8217;http://www.site.com/songs/&#8221; . $file . &#8220;&#8216; /&gt;&#8221;;<br />
}<br />
}<br />
closedir($handle);<br />
}</span></p>
<p><span style="color: #ff0000;">echo &#8220;&lt;/songs&gt;&#8221;;<br />
? &gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/output-xml-with-php-here-loaded-by-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress RSS feed exclude categories or only serve one particular category</title>
		<link>http://alexyz.com/wordpress-rss-feed-exclude-categories-or-only-serve-one-particular-category/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-rss-feed-exclude-categories-or-only-serve-one-particular-category</link>
		<comments>http://alexyz.com/wordpress-rss-feed-exclude-categories-or-only-serve-one-particular-category/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 21:35:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=922</guid>
		<description><![CDATA[// This will make the site feed ONLY contain category id 9. add to wp-content/themes/your-active-theme/function.php function myFilter($query) { if ($query-&#62;is_feed) { $query-&#62;set(&#8216;cat&#8217;,&#8217;9&#8242;); } return $query; } add_filter(&#8216;pre_get_posts&#8217;,&#8217;myFilter&#8216;); // To EXCLUDE categories 9 and 11: function myFilter($query) { if ($query-&#62;is_feed) { $query-&#62;set(&#8216;cat&#8217;,&#8217;-9, -11&#8216;); } return $query; } add_filter(&#8216;pre_get_posts&#8217;,&#8217;myFilter&#8216;);]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">// This will make the site feed ONLY contain category id 9.</span></p>
<p>add to <span style="color: #ff0000;">wp-content/themes/your-active-theme/function.php</span></p>
<p><span style="color: #0000ff;">function</span> <span style="color: #008000;">myFilter</span>($query) {<br />
if ($query-&gt;is_feed) {<br />
$query-&gt;set(&#8216;cat&#8217;,&#8217;9&#8242;);<br />
}<br />
return $query;<br />
}</p>
<p><span style="color: #0000ff;">add_filter</span>(&#8216;pre_get_posts&#8217;,&#8217;<span style="color: #008000;">myFilter</span>&#8216;);</p>
<p><span style="color: #ff0000;">// To EXCLUDE categories 9 and 11:</span></p>
<p><span style="color: #0000ff;">function</span> <span style="color: #008000;">myFilter</span>($query) {<br />
if ($query-&gt;is_feed) {<br />
$query-&gt;set(&#8216;cat&#8217;,&#8217;<strong>-9, -11</strong>&#8216;);<br />
}<br />
return $query;<br />
}</p>
<p><span style="color: #0000ff;">add_filter</span>(&#8216;pre_get_posts&#8217;,&#8217;<span style="color: #008000;">myFilter</span>&#8216;);</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-rss-feed-exclude-categories-or-only-serve-one-particular-category/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>odd annoying Dreamweaver errors</title>
		<link>http://alexyz.com/odd-annoying-dreamweaver-errors/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=odd-annoying-dreamweaver-errors</link>
		<comments>http://alexyz.com/odd-annoying-dreamweaver-errors/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 18:04:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Dreamweaver]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=918</guid>
		<description><![CDATA[Find the Dreamweaver cache file and delete it: C:\Documents and Settings\\Application Data\Macromedia\Dreamweaver\Configuration\WinFileCache-*.dat done source: http://www.gthelp.com/showthread.php?t=80230]]></description>
			<content:encoded><![CDATA[<p>Find the Dreamweaver cache file and delete it:</p>
<p>C:\Documents and Settings\<username>\Application Data\Macromedia\Dreamweaver\Configuration\WinFileCache-*.dat</p>
<p>done</p>
<p>source: <a href="http://www.gthelp.com/showthread.php?t=80230">http://www.gthelp.com/showthread.php?t=80230</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/odd-annoying-dreamweaver-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>anchor tag mailto subject body link example</title>
		<link>http://alexyz.com/anchor-tag-mailto-subject-body-link-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=anchor-tag-mailto-subject-body-link-example</link>
		<comments>http://alexyz.com/anchor-tag-mailto-subject-body-link-example/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 23:11:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=903</guid>
		<description><![CDATA[content in full post]]></description>
			<content:encoded><![CDATA[<p>&lt;a <span style="color: #008000;">href</span>=&#8221;<span style="color: #ff0000;"><span style="color: #0000ff;">mailto:</span>?</span><span style="color: #ff0000;">subject=</span>Whatever you want the subject to be goes here<span style="color: #ff0000;">&amp;body</span>=Whatever you want the body text to be goes here<span style="color: #ff0000;">%0Aurl:</span> http://www.alexyz.com/&#8221;&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/anchor-tag-mailto-subject-body-link-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Custom Structure URL Permalinks</title>
		<link>http://alexyz.com/wordpress-custom-structure-url-permalinks/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-custom-structure-url-permalinks</link>
		<comments>http://alexyz.com/wordpress-custom-structure-url-permalinks/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 17:31:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=886</guid>
		<description><![CDATA[Admin Settings Permalinks Custom Structure radio text entry field use this: /%postname%/ so that your posts appear as they do in this blog, here: http://www.sitename.com/post-name]]></description>
			<content:encoded><![CDATA[<p>Admin</p>
<p>Settings</p>
<p>Permalinks</p>
<p>Custom Structure radio text entry field</p>
<p>use this:</p>
<p><span style="color: #ff0000;">/%postname%/</span></p>
<p>so that your posts appear as they do in this blog, here:</p>
<p>http://www.sitename.com/post-name</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-custom-structure-url-permalinks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>httpd.conf or .htaccess for apache WordPress redirect</title>
		<link>http://alexyz.com/httpd-conf-or-htaccess-for-apache-wordpress-redirect/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=httpd-conf-or-htaccess-for-apache-wordpress-redirect</link>
		<comments>http://alexyz.com/httpd-conf-or-htaccess-for-apache-wordpress-redirect/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 17:26:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache2]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=882</guid>
		<description><![CDATA[a legacy Wordpress blog is being converted to clean/pretty URLs for SEO purposes...]]></description>
			<content:encoded><![CDATA[<p>This is simply a note to save this block of code should I need it again.</p>
<p>The server in question is one of many cloud instances, and local development machines, in an environment using PHP, JAVA, Surf, among other technologies.</p>
<p>In short, it&#8217;s a pretty complex implementation/configuration&#8230;</p>
<p>Some URLs are being rewritten, others forwarded, directory crawling is off, but&#8230;</p>
<p>a legacy WordPress blog is being converted to clean/pretty URLs for SEO purposes</p>
<p>(which &#8220;look&#8221; like directory folder URLs)</p>
<p>(rather than WordPress relying on URL parameters by default)</p>
<p>so, along with editing the WordPress Setting for this,</p>
<p>the following was added to the httpd.conf file:</p>
<p><span style="color: #ff0000;">&lt;IfModule modrewrite.c&gt;</span></p>
<p><span style="color: #ff0000;">RewriteEngine On<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^(.+)$ /podcastInQuestionFolder/index.php [L]</span></p>
<p><span style="color: #ff0000;"> &lt;/IfModule&gt;</span></p>
<p>Of course, quite similar code in the .htaccess within that folder would accomplish a similar aim.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/httpd-conf-or-htaccess-for-apache-wordpress-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress limit search form to a category</title>
		<link>http://alexyz.com/wordpress-limit-search-form-to-a-category-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-limit-search-form-to-a-category-2</link>
		<comments>http://alexyz.com/wordpress-limit-search-form-to-a-category-2/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 00:34:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=847</guid>
		<description><![CDATA[example: &#160; &#60;script&#62; function submitter() { track_it(&#8216;/podcast/searchFormSubmit/&#8217;); document.searchform.submit(); } &#60;/script&#62; &#160; &#60;form method=&#8221;get&#8221; name=&#8221;searchform&#8221; id=&#8221;searchform&#8221; action=&#8221;&#60;?php bloginfo(&#8216;url&#8217;); ?&#62;/&#8221;&#62; &#160; &#60;input type=&#8221;text&#8221; value=&#8221;&#60;?php the_search_query(); ?&#62;&#8221; name=&#8221;s&#8221; id=&#8221;s&#8221; onclick=&#8221;this.value=&#8221;&#8221;/&#62; &#160; This is the important new line, 5 is an example category id &#160; &#60;input type=&#8221;hidden&#8221; name=&#8221;cat&#8221; value=&#8221;5&#8243; /&#62; &#160; &#60;a href=&#8221;javascript:submitter()&#8221; style=&#8221;text-decoration:none;font-size:11px;margin:0 0 0 5px;position:absolute;top:0px;&#8221;&#62;&#60;img src=&#8221;wp-content/themes/New/images/go.png&#8221; onmouseover=&#8221;this.src=&#8217;wp-content/themes/New/images/go-over.png&#8217;&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>example:</p>
<p>&nbsp;</p>
<p><span style="color: #0000ff;">&lt;script&gt;</span><br />
<span style="color: #0000ff;">function submitter()<br />
{<br />
track_it(&#8216;/podcast/searchFormSubmit/&#8217;);<br />
document.searchform.submit();<br />
}</span><br />
<span style="color: #0000ff;">&lt;/script&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #800000;">&lt;form method=&#8221;get&#8221; name=&#8221;searchform&#8221; id=&#8221;searchform&#8221; action=&#8221;&lt;?php bloginfo(&#8216;url&#8217;); ?&gt;/&#8221;&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #800000;">&lt;input type=&#8221;text&#8221; value=&#8221;&lt;?php the_search_query(); ?&gt;&#8221; name=&#8221;s&#8221; id=&#8221;s&#8221; onclick=&#8221;this.value=&#8221;&#8221;/&gt;</span></p>
<p>&nbsp;</p>
<p><strong><span style="color: #ff0000;">This is the important new line, 5 is an example category id</span></strong></p>
<p>&nbsp;</p>
<p><span style="color: #800000;">&lt;input type=&#8221;hidden&#8221; name=&#8221;cat&#8221; value=&#8221;5&#8243; /&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #800000;">&lt;a href=&#8221;javascript:submitter()&#8221; style=&#8221;text-decoration:none;font-size:11px;margin:0 0 0 5px;position:absolute;top:0px;&#8221;&gt;&lt;img src=&#8221;wp-content/themes/New/images/go.png&#8221; onmouseover=&#8221;this.src=&#8217;wp-content/themes/New/images/go-over.png&#8217;&#8221; onmouseout=&#8221;this.src=&#8217;wp-content/themes/New/images/go.png&#8217;&#8221; border=&#8221;0&#8243; /&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #800000;">&lt;/a&gt;<br />
&lt;/form&gt;</span></p>
<p>&nbsp;</p>
<p>source: <a href="http://wpgarage.com/code-snippets/how-to-hack-the-wordpress-search-function-search-categories-and-child-categories/">http://wpgarage.com/code-snippets/how-to-hack-the-wordpress-search-function-search-categories-and-child-categories/</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-limit-search-form-to-a-category-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress Visual editor inactive</title>
		<link>http://alexyz.com/wordpress-visual-editor-inactive/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-visual-editor-inactive</link>
		<comments>http://alexyz.com/wordpress-visual-editor-inactive/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 00:33:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=860</guid>
		<description><![CDATA[All of a sudden you can&#8217;t click on your visual editor tab when adding a post? Did you recently install a new plug-in? Disable it and try again. It isn&#8217;t compatible with your current version&#8230; Just a short note.]]></description>
			<content:encoded><![CDATA[<p>All of a sudden you can&#8217;t click on your visual editor tab when adding a post?<br />
Did you recently install a new plug-in?<br />
Disable it and try again.<br />
It isn&#8217;t compatible with your current version&#8230;<br />
Just a short note.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-visual-editor-inactive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Singleton</title>
		<link>http://alexyz.com/design-patterns-reference-singleton/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-singleton</link>
		<comments>http://alexyz.com/design-patterns-reference-singleton/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 01:55:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=838</guid>
		<description><![CDATA[&#8220;The singleton Design Pattern is used to restrict the number of times a specific object can be created to a single time by providing access to a shared instance of itself.&#8221; &#160; &#8220;The constructor of the object should be a protected method. This will not allow anything but the class itself to create an instance [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The singleton Design Pattern is used to restrict the number of times a specific object can be created to a single time by providing access to a shared instance of itself.&#8221;</p>
<p>&nbsp;</p>
<p>&#8220;The constructor of the object should be a protected method.  This will not allow anything but the class itself to create an instance of it.  Then it can make a public method to actually create, store, and provide that instance.&#8221;</p>
<p>&nbsp;</p>
<p>Most common use: database connection</p>
<p>&nbsp;</p>
<p>More interesting possible use, food for thought: configuration option management&#8230;</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">class</span> <span style="color: #800000;">InventoryConnection</span><br />
{<br />
<span style="color: #008000;">protected</span> static <span style="color: #0000ff;">$_instance</span> = NULL;<br />
<span style="color: #008000;">protected</span> <span style="color: #0000ff;">$_handle</span> = NULL;<br />
<span style="color: #008000;">public static </span>function <span style="color: #800000;">getInstance()</span><br />
{<br />
if(!<span style="color: #ff0000;">self:</span>:<span style="color: #0000ff;">$_instance</span> <span style="color: #008000;">instanceof</span><span style="color: #ff0000;"> self</span>){<br />
<span style="color: #ff0000;">self</span>::<span style="color: #0000ff;">$_instance</span> = <span style="color: #008000;">new</span> <span style="color: #ff0000;">self</span>;<br />
}<br />
return <span style="color: #ff0000;">self</span>::<span style="color: #0000ff;">$_instance</span>;<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">protected</span> function <span style="color: #800000;">__construct()</span><br />
{<br />
$this-&gt;<span style="color: #0000ff;">_handle</span> = mysql_connect(&#8216;localhost&#8217;,'user&#8217;,'pass&#8217;);<br />
mysql_select_db(&#8216;CD&#8217;, $this-&gt;<span style="color: #0000ff;">_handle</span>);<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">public </span>function <span style="color: #800000;">updateQuantity</span>(<span style="color: #ff0000;">$band</span>, <span style="color: #ff0000;">$title</span>, <span style="color: #ff0000;">$number</span>)<br />
{<br />
<span style="color: #0000ff;">$query </span>= &#8220;<span style="color: #800000;">update CDS set amount = amount+</span>&#8221; . <span style="color: #008000;">intval</span>(<span style="color: #ff0000;">$number</span>);<br />
<span style="color: #0000ff;">$query</span> .= &#8221; <span style="color: #800000;">where band=</span>&#8216; &#8221; . <span style="color: #008000;">mysql_real_escape_string</span>(<span style="color: #ff0000;">$band</span>) . &#8221; &#8216; &#8220;;<br />
<span style="color: #0000ff;">$query </span>.= &#8221; <span style="color: #800000;">and title=</span>&#8216; &#8221; . <span style="color: #008000;">mysql_real_escape_string</span>(<span style="color: #ff0000;">$title</span>) . &#8221; &#8216; &#8220;;<br />
<span style="color: #008000;">mysql_query</span>(<span style="color: #0000ff;">$query</span>, $this-&gt;<span style="color: #0000ff;">_handle</span>);<br />
}<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">class </span>CD<br />
{<br />
<span style="color: #008000;">protected</span> $_title = &#8216; &#8216;;<br />
<span style="color: #008000;">protected</span> $_band = &#8216; &#8216;;<br />
<span style="color: #008000;">public</span> function <span style="color: #800000;">__construct</span>(<span style="color: #0000ff;">$title</span>, <span style="color: #0000ff;">$band</span>)<br />
{<br />
$this-&gt;<span style="color: #0000ff;">_title</span> =<span style="color: #0000ff;"> $title</span>;<br />
$this-&gt;<span style="color: #0000ff;">_band</span> = <span style="color: #0000ff;">$band</span>;<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">public</span> function <span style="color: #800000;">buy</span>()<br />
{<br />
<span style="color: #008000;">$inventory</span> = <span style="color: #800000;">InventoryConnection</span>::<span style="color: #800000;">getInstance</span>();<br />
<span style="color: #008000;">$inventory</span>-&gt;<span style="color: #800000;">updateQuantity</span>($this-&gt;<span style="color: #0000ff;">_band</span>, $this-&gt;<span style="color: #0000ff;">_title</span>, -1);<br />
}<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #0000ff;">$boughtCDs</span> = array();<br />
<span style="color: #0000ff;">$boughtCDs[]</span> = array(&#8216;band&#8217;=&gt;&#8217;Never Again&#8217;, &#8216;Waste of a Rib&#8217;);<br />
<span style="color: #0000ff;">$boughtCDs[]</span> = array(&#8216;band&#8217;=&gt;&#8217;Therapee&#8217;, &#8216;Long Road&#8217;);</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">foreach</span>(<span style="color: #0000ff;">$boughtCDs</span> as <span style="color: #0000ff;">$boughtCD</span>){<br />
<span style="color: #0000ff;">$cd</span> = <span style="color: #008000;">new</span> <span style="color: #800000;">CD</span>(<span style="color: #0000ff;">$boughtCD</span>['title'], <span style="color: #0000ff;">$boughtCD</span>['band']);<br />
<span style="color: #0000ff;">$cd</span>-&gt;<span style="color: #800000;">buy</span>();</p>
<p>&nbsp;</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-singleton/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Proxy</title>
		<link>http://alexyz.com/design-patterns-reference-proxy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-proxy</link>
		<comments>http://alexyz.com/design-patterns-reference-proxy/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 02:43:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=785</guid>
		<description><![CDATA[The Proxy Design Pattern buils an object that is positioned transparently within two other objects in order to intercept or proxy the communication or access. &#160; class CD { protected $_title = &#8221;; protected $_band = &#8221;; protected $_handle = null; &#160; public function __construct($title, $band) { $this-&#62;_title = $title; $this-&#62;_band = $band; } &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>The Proxy Design Pattern buils an object that is positioned transparently within two other objects in order to intercept or proxy the communication or access.</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">class</span> CD<br />
{<br />
protected $_title = &#8221;;<br />
protected $_band = &#8221;;<br />
protected $_handle = null;</p>
<p>&nbsp;</p>
<p>public function __construct($title, $band)<br />
{<br />
$this-&gt;_title = $title;<br />
$this-&gt;_band = $band;<br />
}</p>
<p>&nbsp;</p>
<p>public function buy()<br />
{<br />
$this-&gt;_connect();</p>
<p>&nbsp;</p>
<p>$query = &#8220;update CDs set bought=1 where band=&#8217;&#8221;;<br />
$query .= mysql_real_escape_string($this-&gt;_band, $this-&gt;_handle);<br />
$query .= &#8220;&#8216; and title=&#8217;&#8221;;<br />
$query .= mysql_real_escape_string($this-&gt;_title, $this-&gt;_handle);<br />
$query .= &#8220;&#8216;&#8221;;</p>
<p>&nbsp;</p>
<p>mysql_query($query, $this-&gt;_handle);<br />
}</p>
<p>&nbsp;</p>
<p>protected function __connect()<br />
{<br />
$this-&gt;_handle = mysql_connect(&#8216;localhost&#8217;, &#8216;user&#8217;, &#8216;pass&#8217;);<br />
mysql_select_db(&#8216;CD&#8217;, $this-&gt;_handle);<br />
}<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// CD class simply takes a band and title, updates the DB, and completes the sale</span><br />
$externalTitle = &#8220;Waste of a Rib&#8221;;<br />
$externalBand = &#8216;Never Again&#8217;;</p>
<p>&nbsp;</p>
<p>$cd = new CD($externalTitle, $externalBand);<br />
$cd-&gt;buy();</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// A new store in another city will leverage this now via Proxy<br />
// simply by overwriting the protected connect method of the CD class</span><br />
<span style="color: #008000;">class</span> DallasNOCCDProxy extends CD<br />
{<br />
protected function __connect()<br />
{<br />
$this-&gt;_handle = mysql_connect(&#8216;dallas&#8217;, &#8216;user&#8217;,'pass&#8217;);<br />
mysql_select_db(&#8216;CD&#8217;);<br />
}<br />
}</p>
<p>&nbsp;</p>
<p>$externalTitle = &#8220;Waste of a Rib&#8221;;<br />
$externalBand = &#8216;Never Again&#8217;;</p>
<p>&nbsp;</p>
<p>$cd = new DallasNOCCDProxy($externalTitle, $externalBand);<br />
$cd-&gt;buy();</p>
<p>&nbsp;</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Ternary Conditionals quick reference</title>
		<link>http://alexyz.com/php-ternary-conditionals-quick-reference/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-ternary-conditionals-quick-reference</link>
		<comments>http://alexyz.com/php-ternary-conditionals-quick-reference/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 23:34:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=773</guid>
		<description><![CDATA[with variable: &#160; $greeting = (date(&#8220;G&#8221;) &#60; 12) ? &#8216;Good morning&#8217; : &#8216;Good afternoon&#8217;; echo $greeting; &#160; without: &#160; echo (date(&#8220;G&#8221;) &#60; 12) ? &#8216;Good morning&#8217; : &#8216;Good afternoon&#8217;; &#160; another great example courtesy of: http://www.addedbytes.com/php/ternary-conditionals/ alternate color with ternary and modulus: &#160; $i = 1; echo &#8216;&#60;table&#62;&#8217;; while ($data = mysql_fetch_array($result)) { echo &#8216; [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">with variable:</span></p>
<p>&nbsp;</p>
<p>$greeting = (date(&#8220;G&#8221;) &lt; 12) ? &#8216;Good morning&#8217; : &#8216;Good afternoon&#8217;;<br />
echo $greeting;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">without:</span></p>
<p>&nbsp;</p>
<p>echo (date(&#8220;G&#8221;) &lt; 12) ? &#8216;Good morning&#8217; : &#8216;Good afternoon&#8217;;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">another great example<br />
courtesy of:</span><br />
<a href="http://www.addedbytes.com/php/ternary-conditionals/">http://www.addedbytes.com/php/ternary-conditionals/</a><br />
<span style="color: #ff0000;">alternate color with ternary and modulus:</span></p>
<p>&nbsp;</p>
<p>$i = 1;<br />
echo &#8216;&lt;table&gt;&#8217;;<br />
while ($data = mysql_fetch_array($result))<br />
{<br />
echo &#8216; &lt;tr&gt;&#8217;;<br />
echo &#8216; &lt;td bgcolor=&#8221;&#8216;;<br />
echo (($i % 2) == 0) ? &#8216;#eee&#8217; : &#8216;#ddd&#8217; ;<br />
echo &#8216;&#8221;&gt;&#8217;;<br />
echo $data['field'];<br />
echo &#8216; &lt;/td&gt;&#8217;;<br />
echo &#8216; &lt;/tr&gt;&#8217;;<br />
$i++;<br />
}<br />
echo &#8216;&lt;/table&gt;&#8217;;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">/* another basic usage */</span><br />
<span style="color: #ff0000;">courtesty of:</span><br />
<a href="http://davidwalsh.name/php-shorthand-if-else-ternary-operators">http://davidwalsh.name/php-shorthand-if-else-ternary-operators</a></p>
<p>&nbsp;</p>
<p>$message = &#8216;Hello &#8216;.($user-&gt;is_logged_in() ? $user-&gt;get(&#8216;first_name&#8217; )  :  &#8216;Guest&#8217; ) ;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">also see:</span><br />
<a href="http://php.net/manual/en/language.operators.comparison.php">http://php.net/manual/en/language.operators.comparison.php</a><br />
<span style="color: #ff0000;">for more examples,<br />
search the page (F3 in FF) for ternary</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">another nice example from:</span><br />
<a href="http://deadlytechnology.com/web-development-tips/php-ternary-syntax/">http://deadlytechnology.com/web-development-tips/php-ternary-syntax/</a></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">instead of:</span></p>
<p>&nbsp;</p>
<p>$bTest1 = false;<br />
$bTest2 = false;</p>
<p>&nbsp;</p>
<p>if ($bTest1) {<br />
if ($bTest2) {<br />
echo &#8216;test 1 true, test 2 true&#8217;;<br />
}<br />
else {<br />
echo &#8216;test 1 true, test 2 false&#8217;;<br />
}<br />
}<br />
else {<br />
if ($bTest2) {<br />
echo &#8216;test 1 false, test 2 true&#8217;;<br />
}<br />
else {<br />
echo &#8216;test 1 false, test 2 false&#8217;;<br />
}<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">better:</span></p>
<p>&nbsp;</p>
<p>echo $bTest1 ? ( $bTest2? &#8216;test 1 true, test 2 true&#8217; : &#8216;test 1 true, test 2 false&#8217; ) : ( $bTest2 ? &#8216;test 1 false, test 2 true &#8216; : &#8216;test 1 false, test 2 false &#8216;<br />
) ;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-ternary-conditionals-quick-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Prototype</title>
		<link>http://alexyz.com/design-patterns-reference-prototype/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-prototype</link>
		<comments>http://alexyz.com/design-patterns-reference-prototype/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 06:09:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=763</guid>
		<description><![CDATA[&#8220;In situations where a resource intensive object needs to be created often, the Prototype Pattern provides a welcome route to faster execution.&#8221; &#160; &#8220;The Prototype Design Pattern creates objects in such a way that an initial object or prototype can be copied and cloned more efficiently than creating a new instance.&#8221; &#160; class CD { [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;In situations where a resource intensive object needs to be created often, the Prototype Pattern provides a welcome route to faster execution.&#8221;</p>
<p>&nbsp;</p>
<p>&#8220;The Prototype Design Pattern creates objects in such a way that an initial object or prototype can be copied and cloned more efficiently than creating a new instance.&#8221;</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">class CD</span><br />
{<br />
public $band = &#8221;;<br />
public $title = &#8221;;<br />
public $trackList = array();</p>
<p>public function __construct($id)<br />
{<br />
$handle = mysql_connect(&#8216;localhost&#8217;, &#8216;user&#8217;, &#8216;pass&#8217;);<br />
mysql_select_db(&#8216;CD&#8217;, $handle);</p>
<p>$query = &#8220;select band, title, from CDs where id={$id}&#8221;;</p>
<p>$results = mysql_query($query, $handle);</p>
<p>if ($row = mysql_fetch_assoc($results)){<br />
$this-&gt;band = $row['band'];<br />
$this-&gt;title = $row['title'];<br />
}<br />
}</p>
<p>&nbsp;</p>
<p>public function buy()<br />
{<br />
// cd buying magic here<br />
var_dump ($this);<br />
}<br />
}</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">class MixtapeCD extends CD</span><br />
{<br />
public function __close()<br />
{<br />
$this-&gt;title = &#8216;Mixtape&#8217;;<br />
}<br />
}</p>
<p>&nbsp;</p>
<p>$externalPurchaseInfoBandID = 12;<br />
$bandMixProto = new MixtapeCD($externalPurchaseInfoBandID);</p>
<p>&nbsp;</p>
<p>$externalPurchaseInfo = array();<br />
$externalPurchaseInfo[] = array(&#8216;brrr&#8217;, &#8216;goodbye&#8217;);<br />
$externalPurchaseInfo[] = array(&#8216;what it means&#8217;, &#8216;brrr&#8217;);</p>
<p>&nbsp;</p>
<p>foreach ($externalPurchaseInfo as $mixed) {<br />
$cd = clone $bandMixProto;<br />
$cd-&gt;trackList = $mixed;<br />
$cd-&gt;buy();<br />
}</p>
<p>&nbsp;</p>
<p>&#8220;When working with objects whose creation is expensive and whose initial configuration stays relatively the same through new instances, using duplicate classes made with the Prototype Design Pattern is best practice.&#8221;</p>
<p>&nbsp;</p>
<address>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></address>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-prototype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery check if image with specific source exists on page</title>
		<link>http://alexyz.com/jquery-check-if-image-with-specific-source-exists-on-page/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-check-if-image-with-specific-source-exists-on-page</link>
		<comments>http://alexyz.com/jquery-check-if-image-with-specific-source-exists-on-page/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 19:35:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=729</guid>
		<description><![CDATA[$(document).ready(function() { $(&#8220;img&#8221;).each(function(){ imgtofind = &#8220;http://alexyz.com/images/example.jpg&#8221;; source = $(this).attr(&#8216;src&#8217;); if(source == imgtofind){ alert(source); // or otherwise } }); }]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">$(<span style="color: #000000;">document</span>).ready</span>(function() {</p>
<p>$(&#8220;img&#8221;)<span style="color: #0000ff;">.each</span>(function(){<br />
<span style="color: #008000;">imgtofind</span> = &#8220;http://alexyz.com/images/example.jpg&#8221;;<br />
<span style="color: #008000;">source</span> = $(this).attr(&#8216;src&#8217;);<br />
if(<span style="color: #008000;">source</span> == <span style="color: #008000;">imgtofind</span>){<br />
alert(<span style="color: #008000;">source</span>); <span style="color: #ff0000;">// or otherwise</span><br />
}<br />
});</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-check-if-image-with-specific-source-exists-on-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using folder structure, URL, instead of parameters, setup a virtual host, apache httpd-vhosts.conf, and then grab the url via PHP</title>
		<link>http://alexyz.com/using-folder-structure-url-instead-of-parameters-setup-a-virtual-host-apache-httpd-vhosts-conf-and-then-grab-the-url-via-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-folder-structure-url-instead-of-parameters-setup-a-virtual-host-apache-httpd-vhosts-conf-and-then-grab-the-url-via-php</link>
		<comments>http://alexyz.com/using-folder-structure-url-instead-of-parameters-setup-a-virtual-host-apache-httpd-vhosts-conf-and-then-grab-the-url-via-php/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 19:28:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache2]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[httpd-vhosts]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=716</guid>
		<description><![CDATA[This post is about creating a small application in a folder, that behaves like Zend, or you could also say that it behaves like a service, in that it uses (converts) the folder structure of the url for the application&#8217;s use, rather than passing it url parameters. Another common example of such a system is [...]]]></description>
			<content:encoded><![CDATA[<p>This post is about creating a small application in a folder, that behaves like Zend, or you could also say that it behaves like a service, in that it uses (converts) the folder structure of the url for the application&#8217;s use, rather than passing it url parameters. Another common example of such a system is employed by WordPress when &#8220;clean urls&#8221; is turned on.</p>
<p>&nbsp;</p>
<p>Instead of this: <span style="color: #ff0000;">http://alexyz.com?someparameter=something</span></p>
<p>We want this: <span style="color: #ff0000;">http://alexyz.com/something</span></p>
<p>&nbsp;</p>
<p>PHP then acquires that last value (call it a &#8220;command&#8221; or an &#8220;action&#8221; or whatever you&#8217;d like) and proceeds&#8230;</p>
<p>&nbsp;</p>
<p>First, setup an apache virtual host, so that everything after the folder your app will live in is redirected back to that folder&#8217;s index along with any following parameters.  You do this via httpd-vhosts.conf</p>
<p>&nbsp;</p>
<p>example contents of httpd-vhosts.conf (there are several virtual host projects in this example, for independant Zend applications, the code relevant to this lesson is red):</p>
<p>&nbsp;</p>
<p># Setup Listening Port<br />
NameVirtualHost *:80</p>
<p># Ensure &#8220;localhost&#8221; is preserved<br />
&lt;VirtualHost *:80&gt;<br />
ServerName localhost<br />
DocumentRoot &#8220;C:\xampp\htdocs&#8221;</p>
<p><span style="color: #ff0000;">&lt;Location /html/bonus&gt;<br />
RewriteEngine On<br />
RewriteCond %{REQUEST_FILENAME} -s [OR]<br />
RewriteCond %{REQUEST_FILENAME} -l [OR]<br />
RewriteCond %{REQUEST_FILENAME} -d<br />
RewriteRule ^.*$ &#8211; [NC,L]<br />
RewriteRule ^.*$ /html/bonus/index.php [NC,L]<br />
&lt;/Location&gt;</span></p>
<p>&lt;/VirtualHost&gt;</p>
<p># Setup &#8220;components&#8221; Virtual Host<br />
&lt;VirtualHost *:80&gt;<br />
ServerName components<br />
DocumentRoot &#8220;C:\xampp\htdocs\components\public&#8221;</p>
<p>&lt;Directory &#8220;C:\xampp\htdocs\components\public&#8221;&gt;<br />
Options Indexes FollowSymLinks Includes<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;<br />
RewriteEngine off</p>
<p>&lt;Location /&gt;<br />
RewriteEngine On<br />
RewriteCond %{REQUEST_FILENAME} -s [OR]<br />
RewriteCond %{REQUEST_FILENAME} -l [OR]<br />
RewriteCond %{REQUEST_FILENAME} -d<br />
RewriteRule ^.*$ &#8211; [NC,L]<br />
RewriteRule ^.*$ index.php [NC,L]<br />
&lt;/Location&gt;</p>
<p>&lt;/VirtualHost&gt;</p>
<p># Setup &#8220;myzendresource&#8221; Virtual Host<br />
&lt;VirtualHost *:80&gt;<br />
ServerName myzendresource<br />
DocumentRoot &#8220;C:\xampp\htdocs\myzendresource\public&#8221;<br />
&lt;Directory &#8220;C:\xampp\htdocs\myzendresource\public&#8221;&gt;<br />
Options Indexes FollowSymLinks Includes<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</p>
<p># Setup &#8220;datamodels&#8221; Virtual Host<br />
&lt;VirtualHost *:80&gt;<br />
ServerName datamodels<br />
DocumentRoot &#8220;C:\xampp\htdocs\datamodels\public&#8221;<br />
&lt;Directory &#8220;C:\xampp\htdocs\datamodels\public&#8221;&gt;<br />
Options Indexes FollowSymLinks Includes<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;
</p>
<p>&nbsp;</p>
<p>So, any Url after /bonus, in this example, like: http://www.alexyz.com/bonus/something</p>
<p>will be pointed back to /bonus/index.php by apache for us.</p>
<p>&nbsp;</p>
<p>Next, we simply grab that last part of the url in our index.php (in this example it&#8217;s the value &#8220;something&#8221;).  There are many ways we could do this, the example here is a very basic implementation of one way we might grab that value and proceed&#8230;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">&lt; ? php</span></p>
<p>$parameters = explode(&#8220;/&#8221;, <span style="color: #0000ff;">$_SERVER["REQUEST_URI"]</span>);<br />
<span style="color: #0000ff;">foreach</span>($parameters as $param){<br />
if($param != NULL) { <span style="color: #ff0000;">// This won&#8217;t fire if there is a terminating slash, we don&#8217;t want to set the parameter to empty!</span></p>
<p>$bonus_parameter = $param;</p>
<p>}<br />
}
</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// now we can proceed with index.php just as though we&#8217;d done this, but we haven&#8217;t&#8230;:</span></p>
<p>&nbsp;</p>
<p>$param = $_GET['parameterName'];</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/using-folder-structure-url-instead-of-parameters-setup-a-virtual-host-apache-httpd-vhosts-conf-and-then-grab-the-url-via-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL optimization refresher notes</title>
		<link>http://alexyz.com/mysql-optimization-refresher-notes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-optimization-refresher-notes</link>
		<comments>http://alexyz.com/mysql-optimization-refresher-notes/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 18:48:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=712</guid>
		<description><![CDATA[reference: http://www.databasejournal.com/features/mysql/article.php/10897_1382791_1/Optimizing-MySQL-Queries-and-Indexes.htm Notes from above reference: place EXPLAIN before your SELECT and learn a lot! index index index&#8230; in query, if possible, leave indexed field (usually after WHERE&#8230;) alone, or else every record must be calculated prior to conditional analysis&#8230; ANALYZE TABLE tablename; OPTIMIZE TABLE tablename [quote block] EXPLAIN SELECT employee_number,firstname,surname FROM employee WHERE employee_number= [...]]]></description>
			<content:encoded><![CDATA[<p>reference: <a href="http://www.databasejournal.com/features/mysql/article.php/10897_1382791_1/Optimizing-MySQL-Queries-and-Indexes.htm">http://www.databasejournal.com/features/mysql/article.php/10897_1382791_1/Optimizing-MySQL-Queries-and-Indexes.htm</a></p>
<p>Notes from above reference:</p>
<ul>
<li>place EXPLAIN before your SELECT and learn a lot!</li>
<li>index index index&#8230;</li>
<li>in query, if possible, leave indexed field (usually after WHERE&#8230;) alone, or else every record must be calculated prior to conditional analysis&#8230;</li>
<li><code>ANALYZE TABLE tablename;</code></li>
<li><code>OPTIMIZE TABLE tablename </code></li>
</ul>
<pre><code>[quote block]

EXPLAIN SELECT employee_number,firstname,surname
FROM employee
WHERE employee_number= '10875';
</code></pre>
<pre>+--------+----+-------------+----+-------+----+---+---------+
|table   |type|possible_keys|key |key_len|ref |rows| Extra  |
+--------+----+-------------+----+-------+----+---+---------+
|employee|ALL |NULL         |NULL|   NULL|NULL|  2|whereused|
+--------+----+-------------+----+-------+----+---+---------+
</pre>
<p>So what are all these things?</p>
<ul>
<li><em>table</em> shows us which table the output is about (for when you join many tables in the query)</li>
<li><em>type</em> is an important one &#8211; it tells us which type of  join is being used. From best to worst the types are: system, const,  eq_ref, ref, range, index, all</li>
<li><em>possible_keys</em> Shows which possible indexes apply to this table</li>
<li><em>key</em> And which one is actually used</li>
<li><em>key_len</em> give us the length of the key used. The shorter that better.</li>
<li><em>ref</em> Tells us which column, or a constant, is used</li>
<li><em>rows</em> Number of rows mysql believes it must examine to get the data</li>
<li><em>extra</em> Extra info &#8211; the bad ones to see here are &#8220;using temporary&#8221; and &#8220;using filesort&#8221;</li>
</ul>
<p>[quote block end]</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-optimization-refresher-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery select anchor tags that contain specific text, then change id, onClick (Capitalized!!!!), href, :contains, .attr(), .each()</title>
		<link>http://alexyz.com/jquery-select-anchor-tags-that-contain-specific-text-then-change-id-onclick-capitalized-href-contains-attr-each/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-select-anchor-tags-that-contain-specific-text-then-change-id-onclick-capitalized-href-contains-attr-each</link>
		<comments>http://alexyz.com/jquery-select-anchor-tags-that-contain-specific-text-then-change-id-onclick-capitalized-href-contains-attr-each/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 17:32:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=710</guid>
		<description><![CDATA[Easy actually, on load, select an anchor tag (or several, and do the following for .each()), that contains, among other contents, the word &#8216;Read&#8217;, then set its id attribute, a Mouse event, and alter its href value: $(document).ready(function(){ $(&#8220;a:contains(&#8216;Read&#8217;)&#8221;).each(function(){ $(this).attr(&#8216;id&#8216;,&#8217;newid&#8217;); $(this).attr(&#8216;onClick&#8216;, &#8216;return false;&#8217;); // Capitalize the C!!!! $(this).attr(&#8216;href&#8216;, &#8216;http://www.alexyz.com&#8217;); }); }); // alternatively, line them [...]]]></description>
			<content:encoded><![CDATA[<p>Easy actually, on load, select an anchor tag (or several, and do the following for <span style="color: #0000ff;">.each()</span>), that contains, among other contents, the word <span style="color: #ff0000;">&#8216;Read&#8217;</span>,</p>
<p>then set its <span style="color: #0000ff;">id</span> attribute, a <span style="color: #0000ff;">Mouse</span> event, and alter its <span style="color: #0000ff;">href</span> value:</p>
<p><span style="color: #0000ff;">$</span>(<span style="color: #ff6600;">document</span>).<span style="color: #0000ff;">ready</span>(function(){</p>
<p><span style="color: #0000ff;">$</span>(&#8220;<span style="color: #0000ff;">a:contains</span>(<span style="color: #ff0000;">&#8216;Read&#8217;</span>)&#8221;)<span style="color: #0000ff;">.each</span>(function(){</p>
<p><span style="color: #0000ff;">$</span>(<span style="color: #008000;">this</span>)<span style="color: #0000ff;">.attr</span>(&#8216;<span style="color: #800000;">id</span>&#8216;,&#8217;newid&#8217;);</p>
<p><span style="color: #0000ff;">$</span>(<span style="color: #008000;">this</span>).attr(&#8216;<span style="color: #800000;">onClick</span>&#8216;, &#8216;return false;&#8217;); <strong><span style="color: #ff0000;">// Capitalize the C!!!!</span></strong></p>
<p><span style="color: #0000ff;">$</span>(<span style="color: #008000;">this</span>)<span style="color: #0000ff;">.attr</span>(&#8216;<span style="color: #800000;">href</span>&#8216;, &#8216;http://www.alexyz.com&#8217;);</p>
<p>});</p>
<p>});</p>
<p>// alternatively, line them all up like this:</p>
<p><span style="color: #0000ff;">$</span>(<span style="color: #008000;">this</span>)<span style="color: #0000ff;">.attr</span>(&#8216;<span style="color: #993300;">id</span>&#8216;,&#8217;newid&#8217;)<span style="color: #0000ff;">.attr</span>(&#8216;<span style="color: #993300;">onClick</span>&#8216;,&#8217;return false;&#8217;)<span style="color: #0000ff;">.attr</span>(&#8216;<span style="color: #993300;">href</span>&#8216;,&#8217;http://www.alexyz.com&#8217;);</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;">// UPDATE: Better method</span></p>
<p><span style="color: #0000ff;">$</span>(&#8220;a[href<span style="color: #ff0000;">*=</span>'search phrase']&#8220;).<span style="color: #0000ff;">each</span>(function(){<br />
<span style="color: #0000ff;">var</span> postId = <span style="color: #0000ff;">$</span>(<span style="color: #008000;">this</span>).<span style="color: #0000ff;">attr</span>(&#8220;href&#8221;).<span style="color: #0000ff;">split</span>(&#8216;?&#8217;)[1].<span style="color: #0000ff;">split</span>(&#8216;=&#8217;)[1].<span style="color: #0000ff;">split</span>(&#8216;#&#8217;)[0]; <span style="color: #ff0000;">// of course this will vary by need</span><br />
<span style="color: #0000ff;">$</span>(<span style="color: #008000;">this</span>).<span style="color: #0000ff;">attr</span>(&#8220;<span style="color: #ff0000;">href</span>&#8220;,&#8221;?version=full&amp;source=folder&amp;post=&#8221;+postId);<br />
});</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-select-anchor-tags-that-contain-specific-text-then-change-id-onclick-capitalized-href-contains-attr-each/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Observer</title>
		<link>http://alexyz.com/design-patterns-reference-observer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-observer</link>
		<comments>http://alexyz.com/design-patterns-reference-observer/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 22:56:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=696</guid>
		<description><![CDATA[The Observer Design Pattern facilitates the creation of objects that watch the state of a target object and provides state targeted functionality that is uncoupled from the core object. The most obvious example, applications that support some type of plugin system.  Another example, cache systems, or message notification (example, members are notified when an item [...]]]></description>
			<content:encoded><![CDATA[<p>The Observer Design Pattern facilitates the creation of objects that watch the state of a target object and provides state targeted functionality that is uncoupled from the core object.</p>
<p>The most obvious example, applications that support some type of plugin system.  Another example, cache systems, or message notification (example, members are notified when an item is in stock, to add that members may also be notified when it&#8217;s out of stock, simply add another observer, or perhaps another that texts them rather than emailing them&#8230;and so on).</p>
<p>When adding features to software that are activated by an action or state change but are loosely coupled, objects based on the Observer Design Pattern should be created.</p>
<p>MyObject is the Observable object.  It contains a protected array of observers. A public method addObserver() takes an instance of an observer and stores it in the array.</p>
<p>A public method doSomething() applies a state change to MyObject, whose notify() public method then loops through the array of observers.</p>
<p>Each such MyObjectObserver has a public method change(), that accepts an instance of MyObject, which modifies said object via a notify() method of MyObject that calls MyObjectObserver&#8217;s change() method directly as it&#8217;s encountered in the array of observers.</p>
<p><span style="color: #008000;">class CD</span><br />
{<br />
<span style="color: #0000ff;">public</span> $title = &#8221;;<br />
<span style="color: #0000ff;">public</span> $band = &#8221;;<br />
<span style="color: #0000ff;">protected</span> $_observers = array();</p>
<p><span style="color: #0000ff;">public function __construct</span>($title, $band)<br />
{<br />
$this-&gt;title = $title;<br />
$this-&gt;band = $band;<br />
}</p>
<p><span style="color: #0000ff;">public function attachObserver</span>($type, $observer)<br />
{<br />
$this-&gt;_observers[$type][] = $observer;<br />
}</p>
<p><span style="color: #0000ff;">public function notifyObserver</span>($type)<br />
{<br />
if(isset($this-&gt;_observers[$type])){<br />
foreach($this-&gt;_observers[$type] as $observer)<br />
{<br />
$observer-&gt;<span style="color: #0000ff;">update</span>($this);<br />
}<br />
}<br />
}</p>
<p><span style="color: #0000ff;">public function buy</span>()<br />
{<br />
<span style="color: #ff0000;">// stub actions of buying</span><br />
$this-&gt;<span style="color: #0000ff;">notifyObserver</span>(&#8216;purchased&#8217;);<br />
}<br />
}</p>
<p><span style="color: #008000;">class buyCDNotifyStreamObserver</span><br />
{<br />
<span style="color: #0000ff;">public function update</span>(CD $cd)<br />
{<br />
$activity = &#8220;The CD named {$cd-&gt;title} by &#8220;;<br />
$activity .= &#8220;{$cd-&gt;band} was just purchased.&#8221;;<br />
activityStream::<span style="color: #0000ff;">addNewItem</span>($activity);<br />
}<br />
}</p>
<p><span style="color: #008000;">class activityStream</span><br />
{<br />
<span style="color: #0000ff;">public static function addNewItem</span>($item)<br />
{<br />
<span style="color: #ff0000;">// stub functions</span><br />
print $item;<br />
}<br />
}</p>
<p>$title = &#8220;Wast of a Rib&#8221;;<br />
$band = &#8216;Never Again&#8217;;<br />
$cd = <span style="color: #008000;">new CD</span>($title, $band);</p>
<p>$observer = <span style="color: #008000;">new buyCDNotifyStreamOberver</span>();<br />
$cd-&gt;<span style="color: #0000ff;">attachObserver</span>(&#8216;purchased&#8217;, $observer);<br />
$cd-&gt;<span style="color: #0000ff;">buy</span>();</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-observer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Support Prototype script.aculo.us and jQuery, page built with Prototype now being pulled into page that uses jQuery</title>
		<link>http://alexyz.com/support-prototype-script-aculo-us-and-jquery-page-built-with-prototype-now-being-pulled-into-page-that-uses-jquery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=support-prototype-script-aculo-us-and-jquery-page-built-with-prototype-now-being-pulled-into-page-that-uses-jquery</link>
		<comments>http://alexyz.com/support-prototype-script-aculo-us-and-jquery-page-built-with-prototype-now-being-pulled-into-page-that-uses-jquery/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 17:15:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[script.aculo.us]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=635</guid>
		<description><![CDATA[So I developed a handful of sites several years ago using Prototype and script.aculo.us, but now they&#8217;re being pulled into/included/required by pages, a site, that is strictly jQuery, so I need to amend the Prototype site&#8217;s functions to check which library is loaded and then act accordingly. It begs the question, if I were doing [...]]]></description>
			<content:encoded><![CDATA[<p>So I developed a handful of sites several years ago using Prototype and script.aculo.us,</p>
<p>but now they&#8217;re being pulled into/included/required by pages, a site, that is strictly jQuery,</p>
<p>so I need to amend the Prototype site&#8217;s functions to check which library is loaded and then act accordingly.</p>
<p>It begs the question, if I were doing this completely fresh, which pattern (<a href="http://alexyz.com/category/php/design-patterns/">see Design Pattern posts</a>) would I attempt to employ&#8230;? For example, I&#8217;d love to have the option right now to simply write an adapter pattern function instead of burying this conditional within each function&#8230;</p>
<p>Aside from <a href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">Namespacing</a> either or both libraries of course&#8230;</p>
<p>Example:</p>
<p><span style="color: #0000ff;">&lt;script&gt;</span><br />
accordianing = false;<br />
function comments_cabinet()<br />
{<br />
if(accordianing == true)<br />
{<br />
setTimeout( function() { accordian(); }, 25);<br />
}<br />
else<br />
{<br />
accordianing = true;<br />
<span style="color: #0000ff;">/* scriptaculous */</span><br />
<span style="color: #ff0000;">if(window.Prototype)<br />
{ </span><br />
if($(&#8216;comments_button&#8217;).style.display == &#8216;none&#8217;) <span style="color: #ff0000;">// notice the Prototype standard $(&#8221;)</span><br />
<span style="color: #000000;">{</span><br />
new<span style="color: #0000ff;"> Effect.BlindDown</span><span style="color: #0000ff;">(</span>&#8216;comments_button&#8217;, {<br />
duration: 0.5,<br />
afterFinish: function(){<br />
accordianing = false;<br />
}<br />
}<span style="color: #0000ff;">)</span>;<br />
}<br />
else<br />
{<br />
new Effect.BlindUp(&#8216;comments_button&#8217;, {<br />
duration: 0.5,<br />
afterFinish: function(){<br />
accordianing = false;<br />
}<br />
});<br />
}<br />
<span style="color: #ff0000;">}</span><br />
<span style="color: #ff0000;">else<br />
{</span><br />
$(&#8216;#comments_button&#8217;).toggle(&#8216;slow&#8217;); <span style="color: #ff0000;">// otherwise, use the jQuery version $(&#8216;#&#8217;)</span><br />
accordianing = false;<br />
<span style="color: #ff0000;">}</span><br />
return false;<br />
}<br />
}<br />
<span style="color: #0000ff;">&lt;/script&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/support-prototype-script-aculo-us-and-jquery-page-built-with-prototype-now-being-pulled-into-page-that-uses-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Mediator</title>
		<link>http://alexyz.com/design-patterns-reference-mediator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-mediator</link>
		<comments>http://alexyz.com/design-patterns-reference-mediator/#comments</comments>
		<pubDate>Sun, 31 Oct 2010 07:20:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=631</guid>
		<description><![CDATA[The Mediator Design Pattern is used to develop an object that communicates or mediates changes to a collection of similar objects without them interacting with each other directly. class CD { public $band = &#8221;; public $title = &#8221;; protected $_mediator; public function __construct($mediator = null) { $this-&#62;_mediator = $mediator; } public function save() { [...]]]></description>
			<content:encoded><![CDATA[<p>The Mediator Design Pattern is used to develop an object that communicates or mediates changes to a collection of similar objects without them interacting with each other directly.<br />
class CD<br />
{<br />
public $band = &#8221;;<br />
public $title = &#8221;;<br />
protected $_mediator;</p>
<p>public function __construct($mediator = null)<br />
{<br />
$this-&gt;_mediator = $mediator;<br />
}</p>
<p>public function save()<br />
{<br />
<span style="color: #ff0000;">// stub &#8211; writes data back to database &#8211; use this to verify</span><br />
var_dump($this);<br />
}</p>
<p>public function changeBandName($newName)<br />
{<br />
$this-&gt;band = $newName;<br />
$this-&gt;save();<br />
}<br />
}</p>
<p>class MP3Archive<br />
{<br />
public $band = &#8221;;<br />
public $title = &#8221;;<br />
protected $_mediator;</p>
<p>public function __construct($mediator = null)<br />
{<br />
$this-&gt;_mediator = $mediator;<br />
}</p>
<p>public function save()<br />
{<span style="color: #ff0000;"><br />
// stub &#8211; writes data back to database &#8211; use this to verify</span><br />
var_dump($this);<br />
}</p>
<p>public function changeBandName($newName)<br />
{<br />
if (!is_null($this-&gt;_mediator)){<br />
$this-&gt;_mediator-&gt;change($this, array(&#8216;band&#8217;=&gt;$newName));<br />
}<br />
$this-&gt;band = $newName;<br />
$this-&gt;save();<br />
}<br />
}</p>
<p>class MusicContainerMediator<br />
{<br />
protected $_containers = array();</p>
<p>public function __construct()<br />
{<br />
$this-&gt;_containers[] = &#8216;CD&#8217;;<br />
$this-&gt;_containers[] = &#8216;MP3Archive&#8217;;<br />
}</p>
<p>public function change($originalObject, $newValue)<br />
{<br />
$title = $originalObject-&gt;title;<br />
$band = $originalObject-&gt;band;</p>
<p>foreach ($this-&gt;_containers as $container){<br />
if (!($changedObject instanceof $container)){<br />
$object = new $container;<br />
$object-&gt;title = $title;<br />
$object-&gt;band = $band;</p>
<p>foreach ($newValue as $key=&gt;$value){<br />
$object-&gt;key = $val;<br />
}</p>
<p>$object-&gt;save();<br />
}<br />
}<br />
}<br />
}<br />
<span style="color: #ff0000;"><br />
// To use the new Mediator object</span><br />
$titleFromDB = &#8216;Waste of a Rib&#8217;;<br />
$bandFromDB = &#8216;Never Again&#8217;;</p>
<p>$mediator = new MusicContainerMediator();<br />
$cd = new CD($mediator);<br />
$cd-&gt;title = $titleFromDB;<br />
$cd-&gt;band = $bandFromDB;</p>
<p>$cd-&gt;changeBandName(&#8216;Maybe Once More&#8217;);</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-mediator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Podpress Plugin WordPress Outside the Loop Single page</title>
		<link>http://alexyz.com/podpress-plugin-wordpress-outside-the-loop-single-page/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=podpress-plugin-wordpress-outside-the-loop-single-page</link>
		<comments>http://alexyz.com/podpress-plugin-wordpress-outside-the-loop-single-page/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 22:50:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=629</guid>
		<description><![CDATA[Am building a page that pulls in a single post from a WordPress podcast site that I built that uses Podpress. The long and short of it is that it requires instantiating the WordPress app externally, and using a mini-loop, pretty straight forward, but for the longest time I couldn&#8217;t figure out for the life [...]]]></description>
			<content:encoded><![CDATA[<p>Am building a page that pulls in a single post from a WordPress podcast site that I built that uses Podpress. The long and short of it is that it requires instantiating the WordPress app externally, and using a mini-loop, pretty straight forward, but for the longest time I couldn&#8217;t figure out for the life of me why the Podpress player wasn&#8217;t showing up&#8230;</p>
<p>Instead, I was only getting the [display_podcast] token that one places in a post for Podpress and WordPress to then replace upon rendering the post&#8230;</p>
<p>I knew there had to be a simple solution.  My final code is below.  The key: <strong>wp_head();</strong></p>
<p><span style="color: #ff0000;">&lt; ? php</span></p>
<p><span style="color: #008000;">require_once</span>(&#8216;../podcast/wp-load.php&#8217; ); <span style="color: #ff0000;">// load the app</span><br />
<span style="color: #008000;">wp_head()</span>; <span style="color: #ff0000;">// this gets all the plugins and dependencies!!!!</span><br />
<span style="color: #008000;">query_posts(&#8216;p=1807&#8242;)</span>; <span style="color: #ff0000;">// documentation on using query_posts is nice and simple and clear</span><br />
<span style="color: #008000;">while</span> (<span style="color: #008000;">have_posts()</span>) : <span style="color: #008000;">the_post()</span>; <span style="color: #ff0000;">// iterate over the return</span></p>
<p><span style="color: #ff0000;">// use various things to output the data</span></p>
<p><span style="color: #008000;">the_ID()</span>; <span style="color: #008000;">the_time(&#8216;l, F j, Y&#8217;)</span>; <span style="color: #008000;">the_title()</span>; <span style="color: #008000;">the_content()</span>; <span style="color: #ff0000;">// and so on</span></p>
<p><span style="color: #008000;">endwhile;</span></p>
<p><span style="color: #ff0000;">? &gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/podpress-plugin-wordpress-outside-the-loop-single-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Interpreter</title>
		<link>http://alexyz.com/design-patterns-reference-interpreter/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-interpreter</link>
		<comments>http://alexyz.com/design-patterns-reference-interpreter/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 05:14:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=610</guid>
		<description><![CDATA[&#8220;The Interpreter Design Pattern analyzes an entity for key elements and provides its own interpretation or action corresponding to each key.&#8221; class User { protected $_username; public function __construct($username) { $this-&#62;_username = $username; } public function getProfilePage() { // In lieu of getting the data from a DB, we mock here $profile = &#8220;&#60;h2&#62;I like [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Interpreter Design Pattern analyzes an entity for key elements and provides its own interpretation or action corresponding to each key.&#8221;<span style="color: #ff0000;"> </span><br />
class User<br />
{<br />
protected $_username;</p>
<p>public function __construct($username)<br />
{<br />
$this-&gt;_username = $username;<br />
}</p>
<p>public function getProfilePage()<br />
{<br />
<span style="color: #ff0000;">// In lieu of getting the data from a DB, we mock here</span><br />
$profile = &#8220;&lt;h2&gt;I like Never Again!&lt;/h2&gt;&#8221;;<br />
$profile .= &#8220;I love all of their songs. My favorite CD:&lt;br /&gt;&#8221;;<br />
$profile .= &#8220;<span style="color: #ff0000;">{{myCD.getTitle}}</span>!!&#8221;;</p>
<p>return $profile;<br />
}<br />
}</p>
<p>class userCD<br />
{<br />
protected $_user = NULL;</p>
<p>public function setUser($user)<br />
{<br />
$this-&gt;_user = $user;<br />
}</p>
<p>public function getTitle()<br />
{<br />
<span style="color: #ff0000;">// mock here</span><br />
$title = &#8220;Waste of a Rib&#8221;;</p>
<p>return $title;<br />
}<br />
}</p>
<p>class userCDInterpreter<br />
{<br />
protected $_user = NULL;</p>
<p>public function setUser($user)<br />
{<br />
$this-&gt;_user = $user;<br />
}</p>
<p>public function getInterpreted()<br />
{<br />
$profile = $this-&gt;_user-&gt;getProfilePage();</p>
<p>if (preg_match_all(&#8216;/\{\{myCD\.(.*?)\}\}/&#8217;, $profile, $triggers, PREG_SET_ORDER)){<br />
$replacements = array();</p>
<p>foreach($triggers as $trigger){<br />
$replacements[] = $trigger[1];<br />
}<br />
$replacements = array_unique($replacements);<br />
$myCD = new userCD();<br />
$myCD-&gt;setUser($this-&gt;_user);<br />
foreach($replacements as $replacement){<br />
$profile = str_replace(&#8220;<span style="color: #ff0000;">{{myCD.{$replacement}}</span>}&#8221;, <span style="color: #ff0000;">call_user_func(array($myCD, $replacement))</span>, $profile);<br />
}<br />
}<br />
return $profile;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* implementation<br />
*/</span><br />
$username = &#8216;aaron&#8217;;<br />
$user = new User($username);<br />
$interpreter = new userCDInterpreter();<br />
$interpreter-&gt;setUser($user);<br />
print &#8220;&lt;h1&gt;{$username}&#8217;s Profile&lt;/h1&gt;&#8221;;<br />
print $interpreter-&gt;getInterpreted();</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-interpreter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Factory</title>
		<link>http://alexyz.com/design-patterns-reference-factory/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-factory</link>
		<comments>http://alexyz.com/design-patterns-reference-factory/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 04:44:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=606</guid>
		<description><![CDATA[&#8220;The Factory Design Pattern provides a simple interface to acquire a new instance of an object, while sheltering the calling code from the steps to determine which base class is actually instantiated.&#8221; class standardCD { public $title = &#8220;&#8221;; public $band = &#8220;&#8221;; public $tracks = array(); public function __construct() { // } public function [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Factory Design Pattern provides a simple interface to acquire a new instance of an object, while sheltering the calling code from the steps to determine which base class is actually instantiated.&#8221;<br />
class standardCD<br />
{<br />
public $title = &#8220;&#8221;;<br />
public $band = &#8220;&#8221;;<br />
public $tracks = array();</p>
<p>public function __construct()<br />
{<br />
<span style="color: #ff0000;">//</span><br />
}</p>
<p>public function setTitle($title)<br />
{<br />
$this-&gt;title = $title;<br />
}</p>
<p>public function setBand($band)<br />
{<br />
$this-&gt;band = $band;<br />
}</p>
<p>public function addTrack($track)<br />
{<br />
$this-&gt;tracks[] = $track;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* create a complete standardCD object<br />
*/</span><br />
$title = &#8216;Waste of a Rib&#8217;;<br />
$band = &#8216;Never Again&#8217;;<br />
$tracksFromExternalSource = array(&#8216;What It Means&#8217;,'Brrr&#8217;,'Goodbye&#8217;);<br />
$cd = new CD();<br />
$cd-&gt;setTitle($title);<br />
$cd-&gt;setBand($band);<br />
foreach ($tracksFromExternalSource as $track)<br />
{<br />
$cd-&gt;addTrack($track);<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* another slight variation of a CD<br />
* &#8216;enhanced&#8217; is required as well<br />
*/</span><br />
class enhancedCD<br />
{<br />
public $title = &#8220;&#8221;;<br />
public $band = &#8220;&#8221;;<br />
public $tracks = array();</p>
<p>public function __construct()<br />
{<br />
<span style="color: #ff0000;">//</span><br />
}</p>
<p>public function setTitle($title)<br />
{<br />
$this-&gt;title = $title;<br />
}</p>
<p>public function setBand($band)<br />
{<br />
$this-&gt;band = $band;<br />
}</p>
<p>public function addTrack($track)<br />
{<br />
$this-&gt;tracks[] = &#8216;DATA TRACK&#8217;;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* We could use conditional logic<br />
* to determine which class to instantiate<br />
* standardCD or enhancedCD<br />
* but behold, instead, the Factory Pattern!<br />
*/</span><br />
class CDFactory<br />
{<br />
public static function create($type)<br />
{<br />
$class = strtolower($type) . &#8220;CD&#8221;;<br />
return new $class;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Thus, to create a CD or an enhancedCD<br />
*/</span><br />
$type = &#8216;enhanced&#8217;; // or $type = &#8216;standard&#8217;;<br />
$cd = CDFActory::create($type);<br />
$cd-&gt;setBand($band);<br />
$cd-&gt;setTitle($title);<br />
foreach($tracksFromExternalSource as $track)<br />
{<br />
$cd-&gt;addTrack($track);<br />
}</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-factory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Facade</title>
		<link>http://alexyz.com/design-patterns-reference-facade/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-facade</link>
		<comments>http://alexyz.com/design-patterns-reference-facade/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 05:14:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=593</guid>
		<description><![CDATA[&#8220;The Facade Design Pattern hides complexity from a calling object by creating a simple facade interface in front of the collection of required logic and methods.&#8221; class CD { public $tracks = array(); public $band = &#8221;; public $title = &#8221;; public function __construct($title, $band, $tracks) { $this-&#62;title = $title; $this-&#62;band = $band; $this-&#62;tracks = [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Facade Design Pattern hides complexity from a calling object by creating a simple facade interface in front of the collection of required logic and methods.&#8221;</p>
<p>class CD<br />
{<br />
public $tracks = array();<br />
public $band = &#8221;;<br />
public $title = &#8221;;</p>
<p>public function __construct($title, $band, $tracks)<br />
{<br />
$this-&gt;title = $title;<br />
$this-&gt;band = $band;<br />
$this-&gt;tracks = $tracks;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* build a CD<br />
*/</span><br />
$tracksFromExternalSource = array(&#8216;What It Means&#8217;,'Brrr&#8217;,'Goodbye&#8217;);<br />
$title = &#8216;Waste of a Rib&#8217;;<br />
$band = &#8216;Never Again&#8217;;<br />
$cd = new CD($title, $band, $tracksFromExternalSource);</p>
<p>class CDUpperCase<br />
{<br />
public static function makeString(CD $cd, $type)<br />
{<br />
$cd-&gt;$type = strtoupper($cd-&gt;$type);<br />
}</p>
<p>public static function makeArray(CD $cd, $type)<br />
{<br />
$cd-&gt;$type = array_map(&#8216;strtoupper&#8217;, $cd-&gt;$type);<br />
}<br />
}</p>
<p>class CDMakeXML<br />
{<br />
public static function create(CD $cd)<br />
{<br />
$doc = new DomDocument();</p>
<p>$root = $doc-&gt;createElement(&#8216;CD&#8217;);<br />
$root = $doc-&gt;appendChild($root);</p>
<p>$title = $doc-&gt;createElement(&#8216;TITLE&#8217;, $cd-&gt;title);<br />
$title = $root-&gt;appendChild($title);</p>
<p>$band = $doc-&gt;createElement(&#8216;BAND&#8217;, $cd-&gt;band);<br />
$band = $root-&gt;appendChild($band);</p>
<p>$tracks = $doc-&gt;createElement(&#8216;TRACKS&#8217;);<br />
$tracks = $root-&gt;appendChild($tracks);</p>
<p>foreach ($cd-&gt;tracks as $track){<br />
$track = $doc-&gt;createElement(&#8216;TRACK&#8217;, $track);<br />
$track = $tracks-&gt;appendChild($track);<br />
}<br />
return $doc-&gt;saveXML();<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* instead of applying CDUpperCase &amp; CDMake XML on CD object as follows:<br />
*/</span><br />
CDUpperCase::makeString($cd, &#8216;title&#8217;);<br />
CDUpperCase::makeString($cd, &#8216;band&#8217;);<br />
CDUpperCase::makeArray($cd, &#8216;tracks&#8217;);<br />
print CDMakeXML::create($cd);</p>
<p><span style="color: #ff0000;">/**<br />
* a facade object better serves the purpose!<br />
*/</span><br />
class WebServiceFacade<br />
{<br />
public static function makeXMLCall(CD $cd)<br />
{<br />
CDUpperCase::makeString($cd, &#8216;title&#8217;);<br />
CDUpperCase::makeString($cd, &#8216;band&#8217;);<br />
CDUpperCase::makeArray($cd, &#8216;tracks&#8217;);</p>
<p>$xml = CDMakeXML::create($cd);</p>
<p>return $xml;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* thus implemented in ONE line instead, as follows:<br />
*/</span><br />
print WebServiceFacade::makeXMLCall($cd);</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-facade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Delegate</title>
		<link>http://alexyz.com/design-patterns-reference-delegate/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-delegate</link>
		<comments>http://alexyz.com/design-patterns-reference-delegate/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 23:44:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=586</guid>
		<description><![CDATA[&#8220;The Delegate Design Pattern removes decisions and complex functionality from the core object by distributing or delegating them to other objects.&#8221; This example accomplishes this by utilizing PHP&#8217;s ability to dynamically create class instances based on a variable, and thus functionality may be spread across multiple objects rather than managed by one conglomerated block of [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Delegate Design Pattern removes decisions and complex functionality from the core object by distributing or delegating them to other objects.&#8221;</p>
<p>This example accomplishes this by utilizing PHP&#8217;s ability to dynamically create class instances based on a variable, and thus functionality may be spread across multiple objects rather than managed by one conglomerated block of conditional logic.</p>
<p><span style="color: #ff0000;">/**<br />
* version 1<br />
* NON-Delegate implementation<br />
* as you&#8217;ll see,<br />
* could easily become unweildly<br />
* to extend&#8230;<br />
*/</span><br />
class Playlist<br />
{<br />
private $__songs;</p>
<p>public function __construct()<br />
{<br />
$this-&gt;__songs = array();<br />
}</p>
<p>public function addSong($location, $title)<br />
{<br />
$song = array(&#8216;location&#8217;=&gt;$location, &#8216;title&#8217;=&gt;$title);<br />
$this-&gt;__songs[] = $song;<br />
}</p>
<p>public function getM3U()<br />
{<br />
$m3u = &#8220;#EXTM3U\n\n&#8221;;</p>
<p>foreach($this-&gt;__songs as $song){<br />
$m3u .= &#8220;#EXTINF:-1,{$song['title']}\n&#8221;;<br />
$m3u .= &#8220;{$song['location']}\n&#8221;;<br />
}<br />
return $m3u;<br />
}</p>
<p>public function getPLS()<br />
{<br />
$pls = &#8220;[playlist]\nNumberOfEntries=&#8221; . count($this-&gt;__songs) . &#8220;\n\n&#8221;;</p>
<p>foreach ($this-&gt;__songs as $songCount=&gt;$song){<br />
$counter = $songCount + 1;<br />
$pls .= &#8220;File{$counter}={$song['location']}\n&#8221;;<br />
$pls .= &#8220;Title{$counter}={$song['title']}\n&#8221;;<br />
$pls .= &#8220;Length{$counter}=-1\n\n&#8221;;<br />
}<br />
return $pls;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Implemented as follows:<br />
*/</span><br />
$playlist = new Playlist();<br />
$playlist-&gt;addSong(&#8216;/home/aaron/music/brr.mp3&#8242;, &#8216;Brr&#8217;);<br />
$playlist-&gt;addSong(&#8216;/home/aaron/music/goodbye.mp3&#8242;, &#8216;Goodbye&#8217;);<br />
if($externalRetrievedType == &#8216;pls&#8217;){<br />
$playlistContent = $playlist-&gt;getPLS();<br />
}<br />
else {<br />
$playlistContent = $playlist-&gt;getM3U();<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* version 2<br />
* Delegate Design Pattern implementation<br />
*/</span><br />
class newPlaylist<br />
{<br />
private $__songs;<br />
private $__typeObject;</p>
<p>public function __construct($type)<br />
{<br />
$this-&gt;__songs = array();<br />
$object = &#8220;{$type}PlaylistDelegate&#8221;;<br />
$this-&gt;__typeObject = new $object;<br />
}</p>
<p>public function addSong($location, $title)<br />
{<br />
$song = array(&#8216;location&#8217;=&gt;$location, &#8216;title&#8217;=&gt;$title);<br />
$this-&gt;__songs[] = $song;<br />
}</p>
<p>public function getPlaylist()<br />
{<br />
$playlist = $this-&gt;__typeObject-&gt;getPlaylist($this-&gt;__songs);<br />
return $playlist;<br />
}<br />
}</p>
<p>class m3uPlaylistDelegate<br />
{<br />
public function getPlaylist($songs)<br />
{<br />
$m3u = &#8220;#EXTM3U\n\n&#8221;;</p>
<p>foreach ($songs as $song){<br />
$m3u .= &#8220;EXTINF:-1,{$song['title']}\n&#8221;;<br />
$m3u .= &#8220;{$song['location']}\n&#8221;;<br />
}<br />
return $m3u;<br />
}<br />
}</p>
<p>class plsPlaylistDelegate<br />
{<br />
public function getPlaylist($songs)<br />
{<br />
$pls = &#8220;[playlist]\nNumberOfEntries=&#8221; . count($songs) . &#8220;\n\n&#8221;;</p>
<p>foreach($songs as $songCount=&gt;$song){<br />
$counter = $songCount + 1;<br />
$pls .= &#8220;File{$counter}={$song['location']}\n&#8221;;<br />
$pls .= &#8220;Title{$counter}={$song['title']}\n&#8221;;<br />
$pls .= &#8220;Length{$counter}=-1\n\n&#8221;;<br />
}<br />
return $pls;<br />
}<br />
}<br />
<span style="color: #ff0000;"><br />
/**<br />
* Implemented as follows:<br />
*/</span><br />
$externalRetrievedType = &#8216;pls&#8217;;<br />
$playlist = new newPlaylist($externalRetrievedType);<br />
$playlistContent = $playlist-&gt;getPlaylist();</p>
<p><span style="color: #ff0000;">// to see results of course, something like:</span></p>
<p>print_r($playlistContent);</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-delegate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Decorator</title>
		<link>http://alexyz.com/design-patterns-reference-decorator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-decorator</link>
		<comments>http://alexyz.com/design-patterns-reference-decorator/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 09:07:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=584</guid>
		<description><![CDATA[&#8220;The Decorator Design Pattern is best suited for altering or decorating portions of an existing object&#8217;s content or functionality without modifying the structure of the original object.&#8221; class CD { public $trackList; public function __construct() { $this-&#62;trackList = array(); } public function addTrack($track) { $this-&#62;trackList[] = $track; } public function getTrackList() { $output = &#8220;&#8221;; [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Decorator Design Pattern is best suited for altering or decorating portions of an existing object&#8217;s content or functionality without modifying the structure of the original object.&#8221;</p>
<p>class CD<br />
{<br />
public $trackList;</p>
<p>public function __construct()<br />
{<br />
$this-&gt;trackList = array();<br />
}</p>
<p>public function addTrack($track)<br />
{<br />
$this-&gt;trackList[] = $track;<br />
}</p>
<p>public function getTrackList()<br />
{<br />
$output = &#8220;&#8221;;</p>
<p>foreach ($this-&gt;trackList as $num=&gt;$track){<br />
$output .= ($num + 1) . &#8220;) {$track}. &#8220;;<br />
}<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* cd object use<br />
*/</span><br />
$tracksFromExternalSource = array(&#8216;What It Means&#8217;, &#8216;Brr&#8217;, &#8216;Goodbye&#8217;);<br />
$myCD = new CD();<br />
foreach ($trackFromExternalSource as $track){<br />
$myCD-&gt;addTrack($track);<br />
}<br />
print &#8220;The CD contains the following tracks: &#8221; . $myCD-&gt;getTrackList;</p>
<p><span style="color: #ff0000;">/**<br />
* aha, but now the requirements change on us&#8230;<br />
* now all tracks need to display uppercase!<br />
* Instead of modifying the original class,<br />
* or changing the parent-child relationships for such small &#8220;living requirements&#8221;&#8230;<br />
* we use the Decorator design pattern!<br />
*/</span><br />
class CDTrackListDecoratorCaps<br />
{<br />
private $__cd;</p>
<p>public function __construct(CD $cd)<br />
{<br />
$this-&gt;__cd = $cd;<br />
}</p>
<p>public function makeCaps()<br />
{<br />
foreach ($this-&gt;__cd-&gt;trackList as &amp;$track)<br />
{<br />
$track = strtoupper($track);<br />
}<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* new object use<br />
*/</span><br />
$myCD = new CD();<br />
foreach ($tracksFromExternalSource as $track){<br />
$myCD-&gt;addTrack($track);<br />
}<br />
<span style="color: #008000;">$myCDCaps = new CDTrackListDecoratorCaps($myCD);<br />
$myCDCaps-&gt;makeCaps();</span><br />
print &#8220;The CD contains the following tracks: &#8221; . $myCD-&gt;getTrackList();</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-decorator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Data Access Object DAO</title>
		<link>http://alexyz.com/design-patterns-reference-data-access-object-dao/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-data-access-object-dao</link>
		<comments>http://alexyz.com/design-patterns-reference-data-access-object-dao/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 08:13:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=579</guid>
		<description><![CDATA[&#8220;The Data Access Object Design Pattern describes the creation of an object that provides transparent access to any data source.&#8221; /** * Data Access Object Pattern Example */ /** * first we define the abstract base DAO class, * which, of course, thus MUST be extended to be used * to note: * &#8211; the [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Data Access Object Design Pattern describes the creation of an object that provides transparent access to any data source.&#8221;</p>
<p><span style="color: #ff0000;">/**<br />
* Data Access Object Pattern Example<br />
*/</span></p>
<p>/**<br />
* first we define the abstract base DAO class,<br />
* which, of course, thus MUST be extended to be used<br />
* to note:<br />
* &#8211; the connection is internally referenced,<br />
* allowing multiple simultaneous connections and tables<br />
* &#8211; the fetch and update methods are wonderfully abstract<br />
* untied to table name, key, or value<br />
*/<br />
abstract class baseDAO<br />
{<br />
private $__connection;</p>
<p>public function __construct()<br />
{<br />
$this-&gt;__connectToDB(DB_USER, DB_PASS, DB_HOST, DB_DATABASE);<br />
}</p>
<p>public function fetch($value, $key = NULL)<br />
{<br />
if (is_null($key)){<br />
$key = $this-&gt;_primaryKey;<br />
}</p>
<p>$sql = <span style="color: #0000ff;">&#8220;select * from {$this-&gt;_tableName} where {$key}=&#8217;{$value}&#8217;&#8221;</span>;<br />
$results = <span style="color: #008000;">mysql_query</span>($sql, $this-&gt;__connection);</p>
<p>$rows = array();<br />
while ($result = <span style="color: #008000;">mysql_fetch_array</span>($results)){<br />
$rows[] = $result;<br />
}</p>
<p>return $rows;<br />
}</p>
<p>public function update($keyedArray)<br />
{<br />
$sql = <span style="color: #0000ff;">&#8220;update {$this-&gt;_tableName} set &#8220;</span>;</p>
<p>$updates = array();<br />
foreach ($keyedArray as $column=&gt;$value){<br />
$updates[] = <span style="color: #0000ff;">&#8220;{$column}=&#8217;{$value}&#8217;&#8221;</span>;<br />
}</p>
<p>$sql .= implode(&#8216;,&#8217;, $updates);<br />
$sql .= <span style="color: #0000ff;">&#8220;where {$this-&gt;_primaryKey}=&#8217;{$keyedArray[$this-&gt;_primaryKey]}&#8217;&#8221;</span>;</p>
<p><span style="color: #008000;">mysql_query</span>($sql, $this-&gt;__connection);<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Finally, let&#8217;s extend with a child class<br />
* mapped to a specific table<br />
*/</span><br />
class userDAO extends baseDAO<br />
{<br />
protected $_tableName = &#8216;userTable&#8217;;<br />
protected $_primaryKey = &#8216;id&#8217;;</p>
<p>public function getUserByFirstName($name)<br />
{<br />
$result = $this-&gt;fetch($name, &#8216;firstName&#8217;);<br />
return result;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Example of use<br />
* DB connect data, of course, would be elsewhere and flexible<br />
*/</span><br />
define(&#8216;DB_USER&#8217;,'user&#8217;);<br />
define(&#8216;DB_PASS&#8217;,'pass&#8217;);<br />
define(&#8216;DB_HOST&#8217;,'localhost&#8217;);<br />
define(&#8216;DB_DATABASE&#8217;,'test&#8217;);</p>
<p><span style="color: #ff0000;">/** fetch row id 1 **/</span><br />
$user = new userDAO();<br />
$userDetailsArray = $user-&gt;fetch(1);</p>
<p><span style="color: #ff0000;">/** update row id 1 **/</span><br />
$updates = array(&#8216;id&#8217;=&gt;1, &#8216;firstName&#8217;=&gt;&#8217;aaron&#8217;);<br />
$user-&gt;update($updates);</p>
<p><span style="color: #ff0000;">/** get users with first name aaron **/</span><br />
$allAarons = $user-&gt;getUserByFirstName(&#8216;aaron&#8217;);</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-data-access-object-dao/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Builder</title>
		<link>http://alexyz.com/design-patterns-reference-builder/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-builder</link>
		<comments>http://alexyz.com/design-patterns-reference-builder/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 08:08:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=577</guid>
		<description><![CDATA[&#8220;The Builder Design Pattern defines the design of an object that handles the complex building of another object.&#8221; /** * the Builder Pattern * creates objects * so that only its build method need be modified * if the class it builds changes in the future * and to automate object instantiation according to requirements [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Builder Design Pattern defines the design of an object that handles the complex building of another object.&#8221;</p>
<p><span style="color: #ff0000;">/**<br />
* the Builder Pattern<br />
* creates objects<br />
* so that only its build method need be modified<br />
* if the class it builds changes in the future<br />
* and to automate object instantiation according to requirements<br />
*/</span></p>
<p><span style="color: #ff0000;">/**<br />
* class that could change with time<br />
*/</span><br />
class product<br />
{<br />
protected $_type = &#8221;;<br />
protected $_size = &#8221;;<br />
protected $_color = &#8221;;</p>
<p>public function setType($type)<br />
{<br />
$this-&gt;_type = $type;<br />
}</p>
<p>public function setSize($size)<br />
{<br />
$this-&gt;_size = $size;<br />
}</p>
<p>public function setColor($color)<br />
{<br />
$this-&gt;_color = $color;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* thus, rather than implementing each and every<br />
* instantiation of the product class as follows:<br />
*/</span><br />
$productConfigs = array(&#8216;type&#8217;=&gt;&#8217;shirt&#8217;,'size&#8217;=&gt;&#8217;XL&#8217;,'color&#8217;=&gt;&#8217;red&#8217;);<br />
$product = new product();<br />
$product-&gt;setType($productConfigs['type']);<br />
$product-&gt;setSize($productConfigs['size']);<br />
$product-&gt;setColor($productConfigs['color']);</p>
<p><span style="color: #ff0000;">/**<br />
* and then having to change every instantiation<br />
* if/when the product class changes!<br />
* instead, we create a productBuilder,<br />
* and then the change simply happens in the product class<br />
* and in the builder build method<br />
*/</span><br />
class productBuilder<br />
{<br />
protected $_product = NULL;<br />
protected $_xml = array();</p>
<p>public function __construct($configs)<br />
{<br />
$this-&gt;_product = new product();<br />
$this-&gt;_xml = $configs;<br />
}</p>
<p>public function build()<br />
{<br />
$this-&gt;_product-&gt;setSize($configs['size']);<br />
$this-&gt;_product-&gt;setType($configs['type']);<br />
$this-&gt;_product-&gt;setColor($configs['color']);<br />
}</p>
<p>public function getProduct()<br />
{<br />
return $this-&gt;_product;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* implemented, instead as follows:<br />
*/</span><br />
$builder = new productBuilder($productConfigs);<br />
$builder-&gt;build();<br />
$product = $builder-&gt;getProduct();</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-builder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Adapter</title>
		<link>http://alexyz.com/design-patterns-reference-adapter/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-adapter</link>
		<comments>http://alexyz.com/design-patterns-reference-adapter/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 08:04:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=574</guid>
		<description><![CDATA[&#8220;The Adapter Design Pattern simply adapts one object&#8217;s interfaces to what another object expects.&#8221; /** * Example Adapter Class */ /** * original object */ class errorObject { private $__error; public function __construct($error) { $this-&#62;__error  = $error; } public function getError() { return $this-&#62;__error; } } /** * original Log class */ class logToConsole { [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Adapter Design Pattern simply adapts one object&#8217;s interfaces to what another object expects.&#8221;</p>
<p><span style="color: #ff0000;">/**<br />
* Example Adapter Class<br />
*/</span></p>
<p><span style="color: #ff0000;">/**<br />
* original object<br />
*/</span><br />
class errorObject<br />
{<br />
private $__error;</p>
<p>public function __construct($error)<br />
{<br />
$this-&gt;__error  = $error;<br />
}</p>
<p>public function getError()<br />
{<br />
return $this-&gt;__error;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* original Log class<br />
*/</span><br />
class logToConsole<br />
{<br />
private $__errorObject;</p>
<p>public function __construct($errorObject)<br />
{<br />
$this-&gt;__errorObject = $errorObject;<br />
}</p>
<p>public function write()<br />
{<br />
fwrite(STDERR, $this-&gt;__errorObject-&gt;getError());<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Initial way to utilize this system<br />
* create the new 404 error object<br />
*/</span><br />
$error = new errorObject(&#8220;404:Not Found&#8221;);<br />
<span style="color: #ff0000;"><br />
/** then write the error to the console **/</span><br />
$log = new logToConsole($error);<br />
$log-&gt;write();</p>
<p><span style="color: #ff0000;">/**<br />
* extend the logging functionality<br />
* to log to CSV file instead<br />
* with the log # and text<br />
*/</span><br />
class logToCSV<br />
{<br />
const CSV_LOCATION = &#8216;log.csv&#8217;;</p>
<p>private $__errorObject;</p>
<p>public function __construct($errorObject)<br />
{<br />
$this-&gt;__errorObject = $errorObject;<br />
}</p>
<p>public function write()<br />
{<br />
$line = $this-&gt;__errorObject-&gt;getErrorNumber();<br />
$line .= &#8216;,&#8217;;<br />
$line .= $this-&gt;__errorObject-&gt;getErrorText();<br />
$line .= &#8220;\n&#8221;;</p>
<p>file_put_contents(self::CSV_LOCATION, $line, FILE_APPEND);<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* to use the new log<br />
* original errorObject must either be changed<br />
* or better, extended<br />
*/</span><br />
class logToCSVAdapter extends errorObject<br />
{<br />
private $__errorNumber, $__errorText;</p>
<p>public function __construct($error)<br />
{<br />
parent::__construct($error);</p>
<p>$parts = explode(&#8216;:&#8217;, $this-&gt;getError());</p>
<p>$this-&gt;__errorNumber = $parts[0];<br />
$this-&gt;__errorText = $parts[1];<br />
}</p>
<p>public function getErrorNumber()<br />
{<br />
return $this-&gt;__errorNumber;<br />
}</p>
<p>public function getErrorText()<br />
{<br />
return $this-&gt;__errorText;<br />
}<br />
}<br />
<span style="color: #ff0000;"><br />
/**<br />
* new way to implement the system extended<br />
* create the new 404 error object adapted for csv<br />
*/</span><br />
$error = new logToCSVAdapter(&#8220;404:Not Found&#8221;);</p>
<p><span style="color: #ff0000;">/** then write the error to the csv file **/</span><br />
$log = new logToCSV($error);<br />
$log-&gt;write();</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-adapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Reference: Iterator</title>
		<link>http://alexyz.com/design-patterns-reference-iterator-template/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=design-patterns-reference-iterator-template</link>
		<comments>http://alexyz.com/design-patterns-reference-iterator-template/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 08:00:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=571</guid>
		<description><![CDATA[&#8220;The Iterator Design Pattern helps construct objects that can provide a single standard interface to loop or iterate through any type of countable data.&#8221; class  implements Iterator { /** * Get the current element * @return mixed */ public function current() { } /** * Gets the current key * @return mixed */ public function [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Iterator Design Pattern helps construct objects that can provide a single standard interface to loop or iterate through any type of countable data.&#8221;</p>
<p><span style="color: #0000ff;">class  implements</span> <strong>Iterator</strong><br />
{<br />
<span style="color: #ff0000;">/**<br />
* Get the current element<br />
* @return mixed<br />
*/</span><br />
public function current()<br />
{<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Gets the current key<br />
* @return mixed<br />
*/</span><br />
public function key()<br />
{<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Checks if current element exists<br />
* @return boolean<br />
*/</span><br />
public function valid()<br />
{<br />
}<br />
<span style="color: #ff0000;"><br />
/**<br />
* Moves pointer forward to next element<br />
*/</span><br />
public function next()<br />
{<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Moves pointer to first element<br />
*/</span><br />
public function rewind()<br />
{<br />
}<br />
}</p>
<p><span style="color: #ff0000;"><strong>/**<br />
</strong></span></p>
<p><span style="color: #ff0000;"><strong>* Example Implementation</strong></span></p>
<p><span style="color: #ff0000;"><strong>*/</strong></span><br />
class  CD<br />
{<br />
public $band = &#8220;&#8221;;<br />
public $title = &#8220;&#8221;;<br />
public $trackList = array();</p>
<p>public function __construct($band, $title)<br />
{<br />
$this-&gt;band = $band;<br />
$this-&gt;title = $title;<br />
}</p>
<p>public function addTrack($track)<br />
{<br />
$this-&gt;trackList[] = $track;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* SPL Iterator, thus requires:<br />
* current(), key(), rewind(), next(), valid()<br />
* public methods<br />
*/</span><br />
class CDSearchByBandIterator implements Iterator<br />
{<br />
private $__CDs = array();<br />
private $__valid = FALSE;</p>
<p>public function __construct($bandName)<br />
{<br />
$db = mysql_connect(&#8216;localhost&#8217;,'user&#8217;,'pass&#8217;);<br />
mysql_select_db(&#8216;test&#8217;);<br />
$sql = &#8220;select CD.id, CD.band, CD.title, tracks.tracknum, &#8220;;<br />
$sql .= &#8220;tracks.title as tracktitle &#8220;;<br />
$sql .= &#8220;from CD left join tracks on CD.id = tracks.cid where band=&#8217;&#8221;;<br />
$sql .= mysql_real_escape_string($bandname);<br />
$sql .= &#8220;&#8216; order by tracks.tracknum&#8221;;<br />
$results = mysql_query($sql);</p>
<p>$cdID = 0;<br />
$cd = NULL;</p>
<p>while($result = mysql_fetch_array($results)){<br />
if($result['id'] !== $cdID){<br />
if (!is_null($cd)){<br />
$this-&gt;__CDs[] = $cd;<br />
}<br />
$cdID = $result['id'];<br />
$cd = new CD($result['band'], $result['title']);<br />
}<br />
$cd-&gt;addTrack($result['tracktitle']);<br />
}<br />
$this-&gt;__CDs[] = $cd;<br />
}</p>
<p>public function next()<br />
{<br />
$this-&gt;__valid = (next($this-&gt;__CDs) === FALSE) ? FALSE : TRUE;<br />
}</p>
<p>public function rewind()<br />
{<br />
$this-&gt;__valid = (reset($this-&gt;__CDs) === FALSE) ? FALSE : TRUE;<br />
}</p>
<p>public function valid()<br />
{<br />
return $this-&gt;__valid;<br />
}</p>
<p>public function current()<br />
{<br />
return current($this-&gt;__CDs);<br />
}</p>
<p>public function key()<br />
{<br />
return key($this-&gt;__CDs);<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation<br />
*/</span><br />
$queryItem = &#8216;Never Again&#8217;; // band Name<br />
$cds = new CDSearchByBandIterator($queryItem);<br />
print &#8216;&lt;h1&gt;Found the Following CDs&lt;/h1&gt;&#8217;;<br />
print &#8216;&lt;table&gt;&lt;tr&gt;&lt;th&gt;Band&lt;/th&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Num Tracks&lt;/th&gt;&lt;/tr&gt;&#8217;;<br />
foreach ($cds as $cd){<br />
print &#8220;&lt;tr&gt;&lt;td&gt;{$cd-&gt;band}&lt;/td&gt;&lt;td&gt;{$cd-&gt;title}&lt;/td&gt;&lt;td&gt;&#8221;;<br />
print count($cd-&gt;trackList) . &#8216;&lt;/td&gt;&lt;/tr&gt;&#8217;;<br />
}<br />
print &#8216;&lt;/table&gt;&#8217;;</p>
<p>source: <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html">http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470496703,descCd-DOWNLOAD.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/design-patterns-reference-iterator-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Notes: Grabbing a resource from the registry via a view helper</title>
		<link>http://alexyz.com/zend-notes-grabbing-a-resource-from-the-registry-via-a-view-helper/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=zend-notes-grabbing-a-resource-from-the-registry-via-a-view-helper</link>
		<comments>http://alexyz.com/zend-notes-grabbing-a-resource-from-the-registry-via-a-view-helper/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 22:11:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=557</guid>
		<description><![CDATA[Helper (application/views/helpers): class Zend_View_Helper_ImageUrlHelper extends Zend_View_Helper_Abstract { /** * Helper to grab the path to the images directory * @param String $imageName * @param String $imageSize, var for possibly different size requests */ public function ImageUrlHelper($imageName, $imageSize) { $config = Zend_Registry::get(&#8216;config&#8217;); $path = $config-&#62; urlpaths-&#62; productImages; return $path . &#8216;/products_&#8217; . $imageSize . &#8216;/&#8217; . [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Helper (application/views/helpers):</strong></p>
<p><span style="color: #000000;">class <span style="color: #ff0000;">Zend_View_Helper_ImageUrlHelper</span> <span style="color: #008000;">extends</span> <span style="color: #0000ff;">Zend_View_Helper_Abstract</span> {<br />
<span style="color: #ff00ff;">/**<br />
* Helper to grab the path to the images directory<br />
* @param String $imageName<br />
* @param String $imageSize, var for possibly different size requests<br />
*/</span></span> <span style="color: #000000;"><br />
public function ImageUrlHelper($imageName, $imageSize) {<br />
$config = <span style="color: #0000ff;">Zend_Registry::get(&#8216;config&#8217;);</span><br />
$path = <span style="color: #0000ff;">$config-&gt; urlpaths-&gt; productImages;</span><br />
<span style="color: #008000;">return</span> $path . &#8216;/products_&#8217; . $imageSize . &#8216;/&#8217; . $imageName;<br />
}<br />
}</span></p>
<p><strong>application.ini (application/configs):</strong></p>
<p><span style="color: #0000ff;">urlpaths.productImages</span> = &#8220;/path/images/product_images&#8221;</p>
<p><strong>from a view (application/views/scripts/controllerName/viewName.phtml):</strong></p>
<p><span style="color: #000000;"><span style="color: #ff0000;">&lt;?php</span> <span style="color: #ff6600;">$imgSrc</span> = <span style="color: #0000ff;">$this-&gt; ProductImageHelper</span>(<span style="color: #008000;">$this-&gt; products[$i]['products_image']</span>,<span style="color: #008000;"> &#8217;100&#8242;</span>);<span style="color: #ff0000;"> ?&gt;</span></span></p>
<p><span style="color: #000000;">&lt;img border=&#8221;0&#8243;  src=&#8221;<span style="color: #ff0000;">&lt;?php</span> echo <span style="color: #ff6600;">$imgSrc</span>; <span style="color: #ff0000;">?&gt;</span>&#8221; /&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/zend-notes-grabbing-a-resource-from-the-registry-via-a-view-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>framework.zend.com &#8220;Create a Model and Database Table&#8221; tutorial fixed, full working code, adapted for MySQL</title>
		<link>http://alexyz.com/framework-zend-com-create-a-model-and-database-table-tutorial-fixed-full-working-code-adapted-for-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=framework-zend-com-create-a-model-and-database-table-tutorial-fixed-full-working-code-adapted-for-mysql</link>
		<comments>http://alexyz.com/framework-zend-com-create-a-model-and-database-table-tutorial-fixed-full-working-code-adapted-for-mysql/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 18:02:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=539</guid>
		<description><![CDATA[http://framework.zend.com/manual/1.10/en/learning.quickstart.create-model.html Well, I agonized over getting this, and if you read the comments on the tutorial, many others have as well, working on my home Snow Leopard as well as on my work XP pc, and I spent countless hours looking for a post just such as this one is now, to no avail, so [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://framework.zend.com/manual/1.10/en/learning.quickstart.create-model.html">http://framework.zend.com/manual/1.10/en/learning.quickstart.create-model.html</a></p>
<p>Well, I agonized over getting this, and if you read the comments on the tutorial, many others have as well, working on my home Snow Leopard as well as on my work XP pc, and I spent countless hours looking for a post just such as this one is now, to no avail, so here it all is, hope it helps somebody:</p>
<p><strong>hosts</strong></p>
<p>In the event that you don&#8217;t have this done already, here is what should go in your environment&#8217;s hosts file&#8230;</p>
<p>Mac: <span style="color: #800000;">/private/etc/hosts<br />
</span></p>
<p>PC:  <span style="color: #800000;">C:\WINDOWS\system32\drivers\etc</span></p>
<p># Setup &#8220;components&#8221; Virtual Host<br />
&lt;VirtualHost *:80&gt;<br />
ServerName <span style="color: #000000;"><strong>project</strong></span><br />
DocumentRoot &#8220;<span style="color: #800000;">C:\xampp\htdocs\<span style="color: #000000;">project</span>\public</span>&#8221; <span style="color: #800000;">// <strong><span style="color: #000000;">or</span></strong> /Library/WebServer/Documents/<span style="color: #000000;">project</span>/public</span></p>
<p>&lt;Directory &#8220;<span style="color: #800000;">C:\xampp\htdocs\<span style="color: #000000;">project</span>\public</span>&#8221; // <strong>or</strong> <span style="color: #800000;">/Library/WebServer/Documents/<span style="color: #000000;">project</span>/public</span>&gt;<br />
Options Indexes FollowSymLinks Includes<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</p>
<p><span style="color: #000000;"><strong>create the database that this will use</strong></span></p>
<p><span style="color: #800000;">CREATE TABLE IF NOT EXISTS `guestbook` (<br />
`id` int(11) NOT NULL AUTO_INCREMENT,<br />
`email` varchar(32) DEFAULT NULL,<br />
`comment` text,<br />
`created` datetime DEFAULT NULL,<br />
PRIMARY KEY (`id`)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;</span></p>
<p><span style="color: #000000;"><strong>add dummy data to the database</strong></span></p>
<p><span style="color: #800000;">INSERT INTO `guestbook` (`id`, `email`, `comment`, `created`) VALUES<br />
(1, &#8216;ralph@schindler.com&#8217;, &#8216;hello&#8217;, &#8217;2010-09-17 00:00:00&#8242;),<br />
(2, &#8216;foo@bar.com&#8217;, &#8216;goodbye&#8217;, &#8217;2010-09-17 00:00:00&#8242;);</span></p>
<p><strong>if you haven&#8217;t done so already, create the user this app will use to connect, and give the user the priviledges they&#8217;ll need</strong></p>
<p><span style="color: #800000;">CREATE USER &#8216;guestbook&#8217;@'localhost&#8217; IDENTIFIED BY &#8216;guestbook&#8217;;</span></p>
<p><span style="color: #800000;">GRANT ALL ON &#8216;guestbook&#8217; TO &#8216;guestbook&#8217;@'localhost&#8217;;</span></p>
<p><strong><span style="color: #000000;">project/application/Bootstrap.php</span></strong></p>
<p><span style="color: #800000;"><span style="color: #ff0000;">&lt;?php</span><br />
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap<br />
{<br />
public function _initAutoloader()<br />
{<br />
// Create an resource autoloader component<br />
$autoloader = new Zend_Loader_Autoloader_Resource(array(<br />
&#8216;basePath&#8217;    =&gt; APPLICATION_PATH,<br />
&#8216;namespace&#8217; =&gt; &#8216;Application&#8217;<br />
));</span></p>
<p>// Add some resource types<br />
$autoloader-&gt;addResourceTypes(array(<br />
&#8216;forms&#8217; =&gt; array(<br />
&#8216;path&#8217; =&gt; &#8216;forms&#8217;,<br />
&#8216;namespace&#8217; =&gt; &#8216;Form&#8217;<br />
),<br />
&#8216;models&#8217; =&gt; array(<br />
&#8216;path&#8217; =&gt; &#8216;models&#8217;,<br />
&#8216;namespace&#8217; =&gt; &#8216;Model&#8217;<br />
),<br />
));</p>
<p>// Return to bootstrap resource registry<br />
return $autoloader;<br />
}</p>
<p>protected function _initActionHelpers() <span style="color: #800000;"><br />
{<br />
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH .&#8217;/helpers&#8217;);<br />
}</span></p>
<p>protected function _initDoctype() <span style="color: #800000;"><br />
{<br />
$this-&gt;bootstrap(&#8216;view&#8217;);<br />
$view = $this-&gt;getResource(&#8216;view&#8217;);<br />
$view-&gt;doctype(&#8216;XHTML1_STRICT&#8217;);<br />
}<br />
}</span></p>
<p><span style="color: #800000;"><span style="color: #000000;"><strong>project/public/index.php</strong></span></span></p>
<p><span style="color: #800000;"><span style="color: #ff0000;">&lt;?php</span><br />
// Define path to application directory<br />
defined(&#8216;APPLICATION_PATH&#8217;)<br />
|| define(&#8216;APPLICATION_PATH&#8217;, realpath(dirname(__FILE__) . &#8216;/../application&#8217;));</span></p>
<p>// Define application environment<br />
defined(&#8216;APPLICATION_ENV&#8217;)<br />
|| define(&#8216;APPLICATION_ENV&#8217;, (getenv(&#8216;APPLICATION_ENV&#8217;) ? getenv(&#8216;APPLICATION_ENV&#8217;) : &#8216;development&#8217;));</p>
<p>// Ensure library/ is on include_path<br />
set_include_path(implode(PATH_SEPARATOR, array(<br />
realpath(APPLICATION_PATH . &#8216;/../library&#8217;),<br />
get_include_path(),<br />
)));</p>
<p>/** Zend_Application */<br />
require_once &#8216;Zend/Application.php&#8217;;</p>
<p>// Create application, bootstrap, and run<br />
$application = new Zend_Application(<br />
APPLICATION_ENV,<br />
APPLICATION_PATH . &#8216;/configs/application.ini&#8217;<br />
);<br />
$application-&gt;bootstrap()<br />
-&gt;run();</p>
<p><strong>project/application/configs/application.ini</strong></p>
<p><span style="color: #800000;">[production]<br />
phpSettings.display_startup_errors = 0<br />
phpSettings.display_errors = 0<br />
includePaths.library = APPLICATION_PATH &#8220;/../library&#8221;<br />
bootstrap.path = APPLICATION_PATH &#8220;/Bootstrap.php&#8221;<br />
bootstrap.class = &#8220;Bootstrap&#8221;<br />
appnamespace = &#8220;Application&#8221;<br />
resources.frontController.controllerDirectory = APPLICATION_PATH &#8220;/controllers&#8221;<br />
resources.frontController.params.displayExceptions = 0<br />
resources.view[] =<br />
resources.layout.layoutPath = APPLICATION_PATH &#8220;/layouts/scripts/&#8221;</span></p>
<p>resources.db.adapter = &#8220;PDO_MYSQL&#8221;<br />
resources.db.params.host = &#8220;localhost&#8221;<br />
resources.db.params.username = &#8220;guestbook&#8221;<br />
resources.db.params.password = &#8220;guestbook&#8221;<br />
resources.db.params.dbname = &#8220;guestbook&#8221;</p>
<p>[staging : production]</p>
<p>[testing : production]<br />
phpSettings.display_startup_errors = 1<br />
phpSettings.display_errors = 1</p>
<p>[development : production]<br />
phpSettings.display_startup_errors = 1<br />
phpSettings.display_errors = 1<br />
resources.frontController.params.displayExceptions = 1</p>
<p><strong>project/application/controllers/GuestbookController.php</strong></p>
<p><span style="color: #800000;"><span style="color: #ff0000;">&lt;?php</span><br />
class GuestbookController extends Zend_Controller_Action<br />
{</span></p>
<p>public function init() <span style="color: #800000;"><br />
{<br />
/* Initialize action controller here */<br />
}</span></p>
<p>public function indexAction() <span style="color: #800000;"><br />
{<br />
$guestbook = new Application_Model_GuestbookMapper();<br />
$guestbook-&gt;fetchAll();<br />
//var_dump($guestbook);<br />
$this-&gt;view-&gt;entries = $guestbook-&gt;fetchAll();<br />
}<br />
}</span></p>
<p><strong>project/application/models/Guestbook.php</strong></p>
<p><span style="color: #800000;"><span style="color: #ff0000;">&lt;?php</span><br />
class Application_Model_Guestbook<br />
{<br />
protected $_comment;<br />
protected $_created;<br />
protected $_email;<br />
protected $_id;</span></p>
<p>public function __construct(array $options = null)<br />
{<br />
if (is_array($options)){<br />
$this-&gt;setOptions($options);<br />
}<br />
}</p>
<p>public function __set($name, $value) <span style="color: #800000;"><br />
{<br />
$method = &#8216;set&#8217; . $name;<br />
if ((&#8216;mapper&#8217; == $name) || !method_exists($this, $method)){<br />
throw new Exception(&#8216;Invalid guestbook property&#8217;);<br />
}<br />
$this-&gt;$method($value);<br />
}</span></p>
<p>public function __get($name) <span style="color: #800000;"><br />
{<br />
$method = &#8216;get&#8217; . $name;<br />
if ((&#8216;mapper&#8217; == $name) || !method_exists($this, $method)){<br />
throw new Exception(&#8216;Invalid guestbook property&#8217;);<br />
}<br />
return $this-&gt;$method();<br />
}</span></p>
<p>public function setOptions(array $options) <span style="color: #800000;"><br />
{<br />
$methods = get_class_methods($this);<br />
foreach($options as $key =&gt; $value){<br />
$method = &#8216;set&#8217; . ucfirst($key);<br />
if (in_array($method, $methods)){<br />
$this-&gt;$method($value);<br />
}<br />
}<br />
}</span></p>
<p>public function setComment($text) <span style="color: #800000;"><br />
{<br />
$this-&gt;_comment = (string) $text;<br />
return $this;<br />
}</span></p>
<p>public function getComment() <span style="color: #800000;"><br />
{<br />
return $this-&gt;_comment;<br />
}</span></p>
<p>public function setEmail($email) <span style="color: #800000;"><br />
{<br />
$this-&gt;_email = (string) $email;<br />
return $this;<br />
}</span></p>
<p>public function getEmail() <span style="color: #800000;"><br />
{<br />
return $this-&gt;_email;<br />
}</span></p>
<p>public function setCreated($ts) <span style="color: #800000;"><br />
{<br />
$this-&gt;_created = $ts;<br />
return $this;<br />
}</span></p>
<p>public function getCreated() <span style="color: #800000;"><br />
{<br />
return $this-&gt;_created;<br />
}</span></p>
<p>public function setId($id) <span style="color: #800000;"><br />
{<br />
$this-&gt;_id = (int) $id;<br />
return $this;<br />
}</span></p>
<p>public function getId() <span style="color: #800000;"><br />
{<br />
return $this-&gt;_id;<br />
}<br />
}</span></p>
<p><strong><span style="color: #800000;"><span style="color: #000000;">project/application/models/GuesbookMapper.php</span></span></strong></p>
<p><span style="color: #800000;"><span style="color: #ff0000;">&lt;?php</span><br />
class Application_Model_GuestbookMapper<br />
{<br />
protected $_dbTable;</span></p>
<p>public function setDbTable($dbTable) <span style="color: #800000;"><br />
{<br />
if (is_string($dbTable)){<br />
$dbTable = new $dbTable();<br />
}<br />
if (!$dbTable instanceof Zend_Db_Table_Abstract){<br />
throw new Exception(&#8216;Invalid table data gateway provided&#8217;);<br />
}<br />
$this-&gt;_dbTable = $dbTable;<br />
return $this;<br />
}</span></p>
<p>public function getDbTable() <span style="color: #800000;"><br />
{<br />
if (null === $this-&gt;_dbTable){<br />
$this-&gt;setDbTable(&#8216;Application_Model_DbTable_Guestbook&#8217;);<br />
}<br />
return $this-&gt;_dbTable;<br />
}</span></p>
<p>public function save(Application_Model_Guestbook $guestbook) <span style="color: #800000;"><br />
{<br />
$data = array(<br />
&#8216;email&#8217;    =&gt;    $guestbook-&gt;getEmail(),<br />
&#8216;comment&#8217;    =&gt;    $guestbook-&gt;getComment(),<br />
&#8216;created&#8217;    =&gt;    date(&#8216;Y-m-d H:i:s&#8217;),<br />
);</span></p>
<p>if (null === ($id = $guestbook-&gt;getId())){ <span style="color: #800000;"><br />
unset($data['id']);<br />
$this-&gt;getDbTable()-&gt;insert($data);<br />
} else {<br />
$this-&gt;getDbTable()-&gt;update($data,array(&#8216;id = ?&#8217; =&gt; $id));<br />
}<br />
}</span></p>
<p>public function find($id, Application_Model_Guestbook $guestbook) <span style="color: #800000;"><br />
{<br />
$result = $this-&gt;getDbTable()-&gt;find($id);<br />
if (0 == count($result)){<br />
return;<br />
}<br />
$row = $result-&gt;current();<br />
$guestbook-&gt;setId($row-&gt;id)<br />
-&gt;setEmail($row-&gt;email)<br />
-&gt;setComment($row-&gt;comment)<br />
-&gt;setCreated($row-&gt;created);<br />
}</span></p>
<p>public function fetchAll() <span style="color: #800000;"><br />
{<br />
$resultSet = $this-&gt;getDbTable()-&gt;fetchAll();<br />
//var_dump($resultSet);<br />
$entries = array();<br />
foreach ($resultSet as $row){<br />
$entry = new Application_Model_Guestbook();<br />
$entry-&gt;setId($row-&gt;id)<br />
-&gt;setEmail($row-&gt;email)<br />
-&gt;setComment($row-&gt;comment)<br />
-&gt;setCreated($row-&gt;created);<br />
$entries[] = $entry;<br />
}<br />
return $entries;<br />
}<br />
}</span></p>
<p><span style="color: #000000;"><strong>project/application/models/DbTable/Guestbook.php</strong></span></p>
<p><span style="color: #800000;"><span style="color: #ff0000;">&lt;?php</span><br />
class Application_Model_DbTable_Guestbook extends Zend_Db_Table_Abstract<br />
{<br />
/** Table name */<br />
protected $_name    = &#8216;guestbook&#8217;;<br />
}</span></p>
<p><span style="color: #800000;"><strong><span style="color: #000000;">project/application/views/scripts/guestbook/index.phtml</span></strong></span></p>
<p><span style="color: #800000;">&lt;p&gt;&lt;a href=&#8221;<span style="color: #ff0000;">&lt;?php</span> echo $this-&gt;url(<br />
array(<br />
&#8216;controller&#8217; =&gt; &#8216;guestbook&#8217;,<br />
&#8216;action&#8217; =&gt; &#8216;sign&#8217;<br />
),<br />
&#8216;default&#8217;,<br />
true) <span style="color: #ff0000;">?&gt;</span>&#8220;&gt;Sign Our Guestbook&lt;/a&gt;&lt;/p&gt;</span></p>
<p>Guestbook Entries: &lt;br /&gt; <span style="color: #800000;"><br />
&lt;dl&gt;<br />
<span style="color: #ff0000;">&lt;?php</span> foreach ($this-&gt;entries as $entry): <span style="color: #ff0000;">?&gt;</span><br />
&lt;dt&gt;<span style="color: #ff0000;">&lt;?php</span> echo $this-&gt;escape($entry-&gt;email) <span style="color: #ff0000;">?&gt;</span>&lt;/dt&gt;<br />
&lt;dd&gt;<span style="color: #ff0000;">&lt;?php</span> echo $this-&gt;escape($entry-&gt;comment)<span style="color: #ff0000;">?&gt;</span>&lt;/dd&gt;<br />
<span style="color: #ff0000;">&lt;?php</span> endforeach <span style="color: #ff0000;">?&gt;</span><br />
&lt;/dl&gt;</span></p>
<p><strong><span style="color: #000000;">final URL to hit: <span style="color: #000080;">http://<span style="color: #000000;">project</span>/guestbook</span></span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/framework-zend-com-create-a-model-and-database-table-tutorial-fixed-full-working-code-adapted-for-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Mac osx Terminal change root password</title>
		<link>http://alexyz.com/mysql-mac-osx-terminal-change-root-password/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-mac-osx-terminal-change-root-password</link>
		<comments>http://alexyz.com/mysql-mac-osx-terminal-change-root-password/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 03:53:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=537</guid>
		<description><![CDATA[Silly thing to note, but I had to Google for this too long to do it again&#8230; Have to give credit where credit is due, thank you: http://www.cyberciti.biz/faq/mysql-change-root-password/ conclusion, command: mysqladmin -u root password NEWPASSWORD]]></description>
			<content:encoded><![CDATA[<p>Silly thing to note, but I had to Google for this too long to do it again&#8230;</p>
<p>Have to give credit where credit is due, thank you:</p>
<p><a href="http://www.cyberciti.biz/faq/mysql-change-root-password/">http://www.cyberciti.biz/faq/mysql-change-root-password/</a></p>
<p>conclusion, command:</p>
<p><strong><span style="color: #ff0000;">mysqladmin -u root password NEWPASSWORD</span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-mac-osx-terminal-change-root-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac osx Snow Leopard httpd.conf last line error needs removing for virtualhosts to work</title>
		<link>http://alexyz.com/mac-osx-snow-leopard-httpd-conf-last-line-error-needs-removing-for-virtualhosts-to-work/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mac-osx-snow-leopard-httpd-conf-last-line-error-needs-removing-for-virtualhosts-to-work</link>
		<comments>http://alexyz.com/mac-osx-snow-leopard-httpd-conf-last-line-error-needs-removing-for-virtualhosts-to-work/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 03:38:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache2]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=535</guid>
		<description><![CDATA[reference: http://code.google.com/p/virtualhost-sh/issues/detail?id=9 when you uncomment v-hosts in httpd.conf, they won&#8217;t work until you fix that last line&#8230;]]></description>
			<content:encoded><![CDATA[<p>reference:<a href="http://code.google.com/p/virtualhost-sh/issues/detail?id=9"> http://code.google.com/p/virtualhost-sh/issues/detail?id=9</a></p>
<p>when you uncomment v-hosts in httpd.conf, they won&#8217;t work until you fix that last line&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mac-osx-snow-leopard-httpd-conf-last-line-error-needs-removing-for-virtualhosts-to-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OSX remove MySQL</title>
		<link>http://alexyz.com/mac-osx-remove-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mac-osx-remove-mysql</link>
		<comments>http://alexyz.com/mac-osx-remove-mysql/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 08:41:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=533</guid>
		<description><![CDATA[sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* (Edit /etc/hostconfig) sudo vi /etc/hostconfig (Remove line MYSQLCOM=-YES) sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /var/db/receipts/com.mysql.*]]></description>
			<content:encoded><![CDATA[<ol>
<li>sudo rm /usr/local/mysql</li>
<li>sudo rm -rf /usr/local/mysql*</li>
<li>sudo rm -rf /Library/StartupItems/MySQLCOM</li>
<li>sudo rm -rf /Library/PreferencePanes/My*</li>
<li>(Edit /etc/hostconfig) sudo vi /etc/hostconfig (Remove line MYSQLCOM=-YES)</li>
<li>sudo rm -rf /Library/Receipts/mysql*</li>
<li>sudo rm -rf /Library/Receipts/MySQL*</li>
<li>sudo rm -rf /var/db/receipts/com.mysql.*</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mac-osx-remove-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Notes 7: module custom content type, hook_filter(), custom hook, mail API, sends themed email to all members, creates an action and a trigger</title>
		<link>http://alexyz.com/drupal-notes-7-module-with-custom-content-type-filter-custom-hook-mail-api-sends-themed-email-to-all-members-creates-an-action-and-a-trigger/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-notes-7-module-with-custom-content-type-filter-custom-hook-mail-api-sends-themed-email-to-all-members-creates-an-action-and-a-trigger</link>
		<comments>http://alexyz.com/drupal-notes-7-module-with-custom-content-type-filter-custom-hook-mail-api-sends-themed-email-to-all-members-creates-an-action-and-a-trigger/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 00:44:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=524</guid>
		<description><![CDATA[a few of the hooks utilized in this module: hook_help(), hook_node_info(), hook_form(), hook_filter(), hook_filter_tips(), hook_action_info(), hook_theme(), hook_mail(), hook_install() Biggest concept herein: module_invoke_all() Step 1: sitenews.info ; $Id$ name = &#8220;sitenews&#8221; description = &#8220;Sends an email news message to all members&#8221; core = 6.x php = 5.1 ; dependencies = &#8220;trigger&#8221; Step 2: sitenews.module // $Id$ [...]]]></description>
			<content:encoded><![CDATA[<p>a few of the hooks utilized in this module:</p>
<p><span style="color: #ff00ff;">hook_help()</span>, <span style="color: #ff00ff;">hook_node_info()</span>, <span style="color: #ff00ff;">hook_form()</span>, <span style="color: #ff00ff;">hook_filter()</span>, <span style="color: #ff00ff;">hook_filter_tips()</span><span style="color: #000000;">,</span><br />
<span style="color: #ff00ff;">hook_action_info()</span>, <span style="color: #ff00ff;">hook_theme()</span>, <span style="color: #ff00ff;">hook_mail()</span>, <span style="color: #ff00ff;">hook_install()</span></p>
<p><span style="color: #000000;"><strong>Biggest concept herein:</strong> </span><span style="color: #0000ff;">module_invoke_all()<br />
</span></p>
<p><strong>Step 1:</strong> <span style="color: #0000ff;">sitenews.info</span></p>
<p><span style="color: #ff0000;">; $Id$</span><br />
name = &#8220;sitenews&#8221;<br />
description = &#8220;Sends an email news message to all members&#8221;<br />
core = 6.x<br />
php = 5.1<br />
; dependencies = &#8220;trigger&#8221;</p>
<p><strong>Step 2:</strong> <span style="color: #0000ff;">sitenews.module</span></p>
<p><span style="color: #ff0000;">// $Id$<br />
/**<br />
* sitenews Module<br />
* Adds a content type<br />
* Provides an action for admininstrators<br />
* Sends emails to all members<br />
* Defines a new hook and a new filter as well<br />
* @file<br />
*/<br />
/**<br />
* Implementation of hook_help()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_help</span>($path, $arg){<br />
if($path == &#8216;admin/help#sitenews&#8217;){<br />
$txt = &#8216;Keep members current via email.&#8217;<br />
. &#8216;You will need a trigger to the corresponding action.&#8217;<br />
. &#8216;Recommendation: the node publish event should be tied to the action.&#8217;;<br />
$replace = array();<br />
return &#8216;&lt;p&gt;&#8217; . <span style="color: #ff00ff;">t</span>($txt, $replace) . &#8216;&lt;/p&gt;&#8217;;<br />
}<br />
}<br />
<span style="color: #ff00ff;">/**<br />
* Create the sitenewsbrief&#8217; content type<br />
* Implements hook_node_info()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_node_info</span>(){<br />
return array(<br />
&#8216;newsbrief&#8217; =&gt; array(<br />
&#8216;module&#8217; =&gt; &#8216;sitenews&#8217;,<br />
&#8216;name&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;News Brief&#8217;),<br />
&#8216;description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8220;A newsletter to all members&#8221;),<br />
&#8216;has_title&#8217; =&gt; TRUE,<br />
&#8216;title_label&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Title&#8217;),<br />
&#8216;has_body&#8217; =&gt; TRUE,<br />
&#8216;body_label&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;News Brief&#8217;),<br />
)<br />
);<br />
}<br />
<span style="color: #ff00ff;">/**<br />
* Create the form for editing sitenewsbrief nodes<br />
* Implements hook_form()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_form</span>(&amp;$node){<br />
$type = <span style="color: #ff00ff;">node_get_types</span>(&#8216;type&#8217;, $node);<br />
if($type-&gt;has_title){<br />
$form['title'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textfield&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">check_plain</span>($type-&gt;title_label),<br />
&#8216;#required&#8217; =&gt; true,<br />
&#8216;#default_value&#8217; =&gt; $node-&gt;title,<br />
&#8216;#weight&#8217; =&gt; -5,<br />
);<br />
}<br />
if($type-&gt;has_body){<br />
$form['body_field'] = <span style="color: #ff00ff;">node_body_field</span>(<br />
$node,<br />
$type-&gt;<span style="color: #ff00ff;">body_label</span>,<br />
$type-&gt;<span style="color: #ff00ff;">min_word_count</span><br />
);<br />
}<br />
<span style="color: #008000;">return</span> $form;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_filter()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_filter</span>($op, $delta = 0, $format = -1, $text = &#8221;){<br />
<span style="color: #008000;">global </span>$user;</p>
<p>if($op == &#8216;list&#8217;){<br />
$list = array(<br />
0 =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Newsletter Brief Placeholders&#8217;),<br />
1 =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Remove ALL HTML/XML Tags&#8217;),<br />
);<br />
<span style="color: #008000;">return</span> $list;<br />
}</p>
<p><span style="color: #008000;">switch</span>($delta){<br />
// Delta 0 is for replacing placeholders<br />
<span style="color: #008000;">case</span> 0:<br />
<span style="color: #008000;">switch</span> ($op)<br />
{<br />
<span style="color: #008000;">case</span> &#8216;description&#8217;:<br />
<span style="color: #008000;">return</span> <span style="color: #ff00ff;">t</span>(&#8216;Replaces <span style="color: #ff00ff;">{{salutation}}</span> with newsletter brief &#8216;<br />
. &#8216;salutation, and <span style="color: #ff00ff;">{{brief name}}</span> with the newsletter brief &#8216;<br />
. &#8216;name.&#8217;);<br />
case &#8216;prepare&#8217;:<br />
<span style="color: #008000;">return</span> $text;<br />
<span style="color: #008000;">case</span> &#8216;process&#8217;:<br />
$text = <span style="color: #0000ff;">str_replace</span>(<br />
&#8216;<span style="color: #ff00ff;">{{salutation}}</span>&#8216;,<br />
<span style="color: #ff00ff;">variable_get</span>(&#8216;sitenews_salutation&#8217;, &#8216;Dear Community Member&#8217;),<br />
$text<br />
);<br />
$text = <span style="color: #0000ff;">str_replace</span>(<br />
&#8216;<span style="color: #ff00ff;">{{brief name}}</span>&#8216;,<br />
<span style="color: #ff00ff;">variable_get</span>(&#8216;sitenews_name&#8217;, &#8216;Site News&#8217;),<br />
$text<br />
);<br />
<span style="color: #008000;">return</span> $text;<br />
<span style="color: #008000;">case</span> &#8216;settings&#8217;:<br />
$form['sitenews_filter'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;fieldset&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Site Newsletter Filters&#8217;),<br />
&#8216;#collapsible&#8217; =&gt; true,<br />
&#8216;#collapsed&#8217; =&gt; false,<br />
);<br />
$form['sitenews_filter']['sitenews_salutation'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textfield&#8217;,<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;The greeting&#8217;),<br />
&#8216;#title&#8217; =&gt;<span style="color: #ff00ff;"> t</span>(&#8216;Salutation&#8217;),<br />
&#8216;#default_value&#8217; =&gt; <span style="color: #ff00ff;">variable_get</span>(&#8216;sitenews_salutation&#8217;, &#8216;Dear Community Member,&#8217;),<br />
);<br />
$form['sitenews_filter']['sitenews_name'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textfield&#8217;,<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Title of the site newsletter&#8217;),<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Site Newsletter Name&#8217;),<br />
&#8216;#default_value&#8217; =&gt; <span style="color: #ff00ff;">variable_get</span>(&#8216;sitenews_name&#8217;, &#8216;Site Newsletter&#8217;),<br />
);<br />
<span style="color: #008000;">return</span> $form;<br />
}<br />
<span style="color: #008000;">case</span> 1:<br />
<span style="color: #008000;">switch</span>($op)<br />
{<br />
<span style="color: #008000;">case</span> &#8216;description&#8217;:<br />
<span style="color: #008000;">return</span> <span style="color: #ff00ff;">t</span>(&#8216;Removes all tags (HTML or XML elements).&#8217;);<br />
<span style="color: #008000;">case</span> &#8216;prepare&#8217;:<br />
<span style="color: #008000;">return</span> $text;<br />
<span style="color: #008000;">case</span> &#8216;process&#8217;:<br />
<span style="color: #008000;">return</span> <span style="color: #0000ff;">strip_tags</span>($text);<br />
} <span style="color: #ff0000;">// end switch for $op</span><br />
} <span style="color: #ff0000;">// end outer switch</span><br />
}<br />
<span style="color: #ff0000;">/**<br />
* Formatting instruction tips for content creators<br />
* Implements hook_format_info()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_filter_tips</span>($delta, $format, $long){<br />
<span style="color: #008000;">switch</span>($delta){<br />
<span style="color: #008000;">case</span> 0:<br />
$text = &#8220;Instances of <span style="color: #ff00ff;">{{brief name}}</span> will be &#8221;<br />
. &#8220;replaced by the global name for site newsletter.&#8221;<br />
. &#8221; <span style="color: #ff00ff;">{{salutation}}</span> will be replaced with the global &#8221;<br />
. &#8220;greeting message.&#8221;;<br />
if($long){<br />
$text .= &#8220;Site Newsletter name and salutation text &#8221;<br />
. &#8220;can be configured from the administration interface.&#8221;;<br />
}<br />
<span style="color: #008000;">return</span> $text;<br />
<span style="color: #008000;">case</span> 1:<br />
$text = &#8220;HTML and XML tags will be removed from the final output&#8221;;<br />
return $text;<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Get a format ID by name<br />
* This returns an Input Format ID that can be passed to check_marckup() to filter content<br />
* If a matching format isn&#8217;t found, the default format is returned<br />
* @param $name<br />
* String name of the format<br />
* @return<br />
* The ID (an integer) of the format<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_get_format</span>($name){<br />
$res = <span style="color: #ff00ff;">db_query</span>(<br />
&#8220;<span style="color: #008000;">SELECT format FROM {filter_formats} WHERE name = &#8216;%s&#8217;</span>&#8220;,<br />
$name<br />
);<br />
$format = <span style="color: #ff00ff;">db_fetch_object</span>($res);<br />
if($format){<br />
<span style="color: #008000;">return</span> $format-&gt;format;<br />
} else {<br />
<span style="color: #008000;">return</span> <span style="color: #ff00ff;">FILTER_FORMAT_DEFAULT</span>;<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_action_info()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_action_info</span>(){<br />
<span style="color: #ff00ff;">watchdog</span>(&#8216;<span style="color: #ff00ff;">action</span>&#8216;,&#8221;Called sitenews_action_info&#8221;);<br />
$actions['sitenews_send_action'] = array(<br />
&#8216;type&#8217; =&gt; &#8216;node&#8217;,<br />
&#8216;description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Send site news as email to all users.&#8217;),<br />
&#8216;configurable&#8217; =&gt; FALSE,<br />
&#8216;hooks&#8217; =&gt; array(<br />
&#8216;nodeapi&#8217; =&gt; array(&#8216;insert&#8217;,'update&#8217;,'presave&#8217;),<br />
)<br />
);<br />
return $actions;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Action: Send an email message to all users<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_send_action</span>(&amp;$object, $context){<br />
// If not a published sitenews, skip<br />
if(!$object-&gt;status || $object-&gt;type != &#8216;newsbrief&#8217;){<br />
<span style="color: #008000;">return</span>;<br />
}<br />
<span style="color: #ff0000;">// Get addresses</span><br />
$q = &#8220;<span style="color: #008000;">SELECT mail, status FROM {users} &#8221;<br />
. &#8220;WHERE status != 0 AND uid &gt; 0</span>&#8220;;<br />
$results = <span style="color: #ff00ff;">db_query</span>($q);<br />
$addresses = array();<br />
while($obj = <span style="color: #ff00ff;">db_fetch_object</span>($results)){<br />
$addresses[] = $obj-&gt;mail;<br />
}<br />
if(count($addresses) == 0){<br />
<span style="color: #ff00ff;">watchdog</span>(<br />
&#8216;sitenews&#8217;,<br />
&#8216;No user email addresses were found&#8217;,<br />
array(),<br />
<span style="color: #ff00ff;">WATCHDOG_ERROR</span><br />
);<br />
<span style="color: #008000;">return</span>;<br />
}<br />
<span style="color: #ff0000;">// Execute hook_sitenews()</span><br />
<strong><span style="color: #ff00ff;">$content = module_invoke_all(&#8216;sitenews&#8217;);</span></strong><br />
<span style="color: #ff0000;">// Build params</span><br />
$params = array(<br />
&#8216;node&#8217; =&gt; $object,<br />
&#8216;to&#8217; =&gt; implode(&#8216;, &#8216;, $addresses),<br />
&#8216;subject&#8217; =&gt; $object-&gt;title,<br />
&#8216;context&#8217; =&gt; $context,<br />
&#8216;additional content&#8217; =&gt; $content,<br />
);<br />
$message = <span style="color: #ff00ff;">_sitenews_do_message</span>($object, $params);<br />
<span style="color: #ff00ff;">watchdog</span>(<br />
&#8216;<span style="color: #ff00ff;">actions</span>&#8216;,<br />
&#8216;Site News &#8220;Send action fired. Sending to !mail&#8217;,<br />
array(&#8216;!mail&#8217; =&gt; $params['to'])<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Internal function to prepare a message and pass it on to the mailer<br />
* @param $node<br />
* The news brief node<br />
* @param $params<br />
* An array of params<br />
*/</span><br />
function <span style="color: #ff00ff;">_sitenews_do_message</span>(&amp;$node, $params){<br />
$node = $params['node'];<br />
$content = $params['additional content'];<br />
<span style="color: #ff0000;">// Theme the main node:</span><br />
$params['body'] = <span style="color: #ff00ff;">theme</span>(&#8216;sitenews_newsbrief&#8217;, $node);<br />
<span style="color: #ff0000;">// See common.inc (element_sort() and drupal_render()</span><br />
<span style="color: #0000ff;">uasort</span>($content, &#8216;element_sort&#8217;);<br />
<span style="color: #ff0000;">// Render each block of content;</span><br />
foreach($content as $item){<br />
$params['body'] .=<span style="color: #ff00ff;"> theme</span>(&#8216;sitenews_msgblock&#8217;, $item);<br />
}<br />
<span style="color: #ff0000;">// Send the mail:</span><br />
<span style="color: #ff00ff;">drupal_mail</span>(<br />
&#8216;sitenews&#8217;,<br />
&#8216;sendsitenews&#8217;,<br />
$params['to'],<br />
language_default(),<br />
$params,<br />
<span style="color: #ff00ff;">variable_get</span>(&#8216;site_mail&#8217;,NULL),<br />
TRUE<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_theme()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_theme</span>(){<br />
<span style="color: #008000;">return</span> array(<br />
&#8216;sitenews_msgblock&#8217; =&gt; array(<br />
&#8216;arguments&#8217; =&gt; array(&#8216;block&#8217; =&gt; NULL),<br />
),<br />
&#8216;sitenews_newsbrief&#8217; =&gt; array(<br />
&#8216;arguments&#8217; =&gt; array(&#8216;node&#8217; =&gt; NULL),<br />
),<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Theme to display a news brief in a sitenews message block<br />
* @param $node<br />
* The news brief node object<br />
*/</span><br />
function <span style="color: #ff00ff;">theme_sitenews_newsbrief</span>($node){<br />
$format = <span style="color: #ff00ff;">sitenews_get_format</span>(&#8216;Tagless text&#8217;);<br />
$text = <span style="color: #0000ff;">strtoupper</span>(check_markup($node-&gt;title, $format)) . &#8220;\n\n&#8221;;<br />
$text .= <span style="color: #ff00ff;">check_markup</span>($node-&gt;body, $format) . &#8220;\n\n&#8221;;<br />
return $text;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Theme for email messages<br />
* @param $block<br />
* A block with #title and #body set<br />
*/</span><br />
function <span style="color: #ff00ff;">theme_sitenews_msgblock</span>($block){<br />
$msg = array();<br />
if(!empty($block['#title'])){<br />
$title = <span style="color: #0000ff;">strtoupper</span>($block['#title']);<br />
for ($i = 0; $i &lt; strlen($title); ++$i){<br />
$underline .= &#8216;=&#8217;;<br />
}<br />
$msg[] = $title;<br />
$msg[] = $underline;<br />
}<br />
$msg[] = $block['#body'] .&#8221;\n&#8221;; // &lt;&#8211; extra newline<br />
return<span style="color: #0000ff;"> implode</span>(&#8220;\n&#8221;, $msg);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_mail()<br />
*/</span><br />
function sitenews<span style="color: #ff00ff;">_mail</span>($key, &amp;$message, $params){<br />
<span style="color: #008000;">switch</span>($key){<br />
<span style="color: #008000;">case</span> &#8216;sendsitenews&#8217;:<br />
$message['to'] = $params['to'];<br />
$message['subject'] = $params['subject'];<br />
$message['body'] = $params['body'];<br />
}<br />
}</p>
<p><strong>Step 3:</strong> <span style="color: #0000ff;">sitenews.install</span></p>
<p>// $Id$<br />
/**<br />
* Install the newsletter module<br />
* @file<br />
*/<br />
/**<br />
* Implements hook_intall()<br />
*/<br />
function sitenews<span style="color: #ff00ff;">_install</span>(){<br />
$name = &#8216;Tagless text&#8217;;<br />
<span style="color: #ff0000;">// Check to see if the format already exists</span><br />
$res = <span style="color: #ff00ff;">db_query</span>(<br />
&#8220;<span style="color: #008000;">SELECT name FROM {filter_formats} WHERE name = &#8216;%s&#8217;</span>&#8220;,<br />
$name<br />
);<br />
$has_format = <span style="color: #ff00ff;">db_result</span>($res);<br />
<span style="color: #ff0000;">// Create format</span><br />
if (!$has_format){<br />
<span style="color: #ff00ff;">db_query</span>(<br />
&#8220;<span style="color: #008000;">INSERT INTO {filter_formats} (name) VALUES (&#8216;%s&#8217;)</span>&#8220;,<br />
$name<br />
);<br />
}<br />
$res = <span style="color: #ff00ff;">db_query</span>(<br />
&#8220;<span style="color: #008000;">SELECT format FROM {filter_formats} WHERE name = &#8216;%s&#8217;</span>&#8220;,<br />
$name<br />
);<br />
$format = <span style="color: #ff00ff;">db_fetch_object</span>($res);<br />
$q = &#8220;<span style="color: #008000;">INSERT INTO {filters} (format, module, delta, weight) &#8221;<br />
. &#8220;VALUES(%d, &#8216;newsletter&#8217;, %d, %d)</span>&#8220;;<br />
<span style="color: #ff0000;">// First, insert the &#8220;Newsletter Brief Placeholders&#8221; filter:</span><br />
<span style="color: #ff00ff;">db_query</span>($q, $format-&gt;format, 0, 10);<br />
<span style="color: #ff0000;">// Second, insert the &#8220;Remove ALL HTML/XML Tags&#8221; filter:</span><br />
<span style="color: #ff00ff;">db_query</span>($q, $format-&gt;format, 1, 0);<br />
}</p>
<p><strong>Step 4: </strong>add to <span style="color: #0000ff;">module_sitenews()</span> to any modules that will be contributing content to these automatically generated email newsletters, example from <span style="color: #0000ff;">personality module</span> (Drupal Notes 6) follows:</p>
<p>function <span style="color: #ff00ff;">personality_theme()</span>{<br />
return array(<br />
&#8216;personality_info&#8217; =&gt; array(<br />
&#8216;template&#8217; =&gt; &#8216;personality_info&#8217;,<br />
&#8216;arguments&#8217; =&gt; array(<br />
&#8216;dates&#8217; =&gt; NULL,<br />
&#8216;life&#8217; =&gt; NULL,<br />
&#8216;works&#8217; =&gt; NULL,<br />
),<br />
),<br />
<span style="color: #ff0000;">// NEW</span><br />
&#8216;personality_sitenews&#8217; =&gt; array(<br />
&#8216;arguments&#8217; =&gt; array(&#8216;node&#8217; =&gt; NULL),<br />
),<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Theme function for sitenews<br />
*/</span><br />
function <span style="color: #ff00ff;">theme_personality_sitenews</span>($node){<br />
$options = array(&#8216;absolute&#8217; =&gt; TRUE);<br />
$url = <span style="color: #ff00ff;">url</span>(&#8216;node/&#8217;. $node-&gt;nid, $options);<br />
$title = <span style="color: #0000ff;">strip_tags</span>($node-&gt;title);<br />
$body = <span style="color: #0000ff;">strip_tags</span>($node-&gt;teaser); // &lt;&#8211; Summary<br />
$text = <span style="color: #0000ff;">implode</span>(&#8220;\n&#8221;, array($title, $body, $url));<br />
$text .= &#8220;\n&#8221;;<br />
<span style="color: #008000;">return</span> $text;<br />
}</p>
<p><span style="color: #ff0000;">/*<br />
* Implements hook_sitenews() in sitenews module<br />
*/</span><br />
function <span style="color: #ff00ff;">personality_sitenews</span>(){<br />
$q = &#8220;<span style="color: #008000;">SELECT nid, created FROM {node} &#8221;<br />
. &#8220;WHERE status = 1 AND type = &#8216;personality&#8217; &#8221;<br />
. &#8220;ORDER BY created DESC</span>&#8220;;<br />
$results = <span style="color: #ff00ff;">db_query_range</span>($q, 0, 3);<br />
$new_bios = array();<br />
while ($row = <span style="color: #ff00ff;">db_fetch_object</span>($results)){<br />
$node = <span style="color: #ff00ff;">node_load</span>($row-&gt;nid);<br />
$new_bios[] =<span style="color: #ff00ff;"> theme</span>(&#8216;personality_sitenews&#8217;, $node);<br />
}<br />
$content['personality'] = array(<br />
&#8216;#weight&#8217; =&gt; 0,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Recent Biographies&#8217;),<br />
&#8216;#body&#8217; =&gt; <span style="color: #0000ff;">implode</span>(&#8220;\n&#8221;, $new_bios),<br />
);<br />
<span style="color: #008000;">return</span> $content;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/drupal-notes-7-module-with-custom-content-type-filter-custom-hook-mail-api-sends-themed-email-to-all-members-creates-an-action-and-a-trigger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Notes 6: module + new content type (non CCK)</title>
		<link>http://alexyz.com/drupal-notes-6-module-new-content-type-non-cck/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-notes-6-module-new-content-type-non-cck</link>
		<comments>http://alexyz.com/drupal-notes-6-module-new-content-type-non-cck/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 21:19:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=512</guid>
		<description><![CDATA[Description: Module that uses a new content type (non CCK), that uses the Schema API, Node API, Database API, Forms API and the following hooks: hook_form(), hook_install(), hook_uninstall(), hook_schema(), hook_node_info(), hook_perm(), hook_access(), hook_insert(), hook_update(), hook_delete(), hook_nodeapi(), hook_load(), hook_view(), hook_theme() Step 1: sites/all/modules/personality folder Step 2: personality.info ; $Id$ name = &#8220;Personality Content (Node) Type&#8221; description [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color: #0000ff;">Description:</span></strong> Module that uses a new content type (non CCK), that uses the <strong>Schema API</strong>, <strong>Node API</strong>, <strong>Database API</strong>, <strong>Forms API</strong> and the following hooks:</p>
<p><span style="color: #ff00ff;">hook_form()</span>, <span style="color: #ff00ff;">hook_install()</span>, <span style="color: #ff00ff;">hook_uninstall()</span>, <span style="color: #ff00ff;">hook_schema()</span>, <span style="color: #ff00ff;">hook_node_info()</span>, <span style="color: #ff00ff;">hook_perm()</span>, <span style="color: #ff00ff;">hook_access()</span>, <span style="color: #ff00ff;">hook_insert()</span>, <span style="color: #ff00ff;">hook_update()</span>, <span style="color: #ff00ff;">hook_delete()</span>, <span style="color: #ff00ff;">hook_nodeapi()</span>, <span style="color: #ff00ff;">hook_load()</span>, <span style="color: #ff00ff;">hook_view()</span>, <span style="color: #ff00ff;">hook_theme()</span></p>
<p><strong>Step 1: <span style="color: #0000ff;">sites/all/modules/personality</span></strong> folder</p>
<p><strong>Step 2: <span style="color: #0000ff;">personality.info</span></strong></p>
<p><span style="color: #ff0000;">; $Id$</span><br />
name = &#8220;Personality Content (Node) Type&#8221;<br />
description = &#8220;This provides a custom content type to store simple online personalities&#8221;<br />
core = 6.x<br />
php = 5.1</p>
<p><strong>Step 3: <span style="color: #0000ff;">personality.install</span></strong></p>
<p><span style="color: #ff0000;">// $Id$<br />
/**<br />
* Install the personality module, including its content (node) type.<br />
* @file<br />
*/</span><br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_install()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_install</span>(){<br />
<span style="color: #ff00ff;">drupal_install_schema</span>(&#8216;personality&#8217;);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_uninstall()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_uninstall</span>(){<br />
<span style="color: #ff00ff;">drupal_uninstall_schema</span>(&#8216;personality&#8217;);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_schema()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_schema</span>(){<br />
$schema['personality'] = array(<br />
&#8216;fields&#8217; =&gt; array(<br />
&#8216;vid&#8217; =&gt; array(<br />
&#8216;type&#8217; =&gt; &#8216;int&#8217;,<br />
&#8216;unsigned&#8217; =&gt; TRUE,<br />
&#8216;not null&#8217; =&gt; TRUE,<br />
&#8216;default&#8217; =&gt; 0,<br />
),<br />
&#8216;nid&#8217; =&gt; array(<br />
&#8216;type&#8217; =&gt; &#8216;int&#8217;,<br />
&#8216;unsigned&#8217; =&gt; TRUE,<br />
&#8216;not null&#8217; =&gt; TRUE,<br />
&#8216;default&#8217; =&gt;0,<br />
),<br />
&#8216;dates&#8217; =&gt; array(<br />
&#8216;type&#8217; =&gt; &#8216;varchar&#8217;,<br />
&#8216;length&#8217; =&gt; 127,<br />
&#8216;not null&#8217; =&gt; TRUE,<br />
&#8216;default&#8217; =&gt; &#8221;,<br />
),<br />
<span style="color: #ff0000;">// Note: On MySQL, text fields cannot have default values</span><br />
&#8216;life&#8217; =&gt; array(<br />
&#8216;type&#8217; =&gt; &#8216;text&#8217;,<br />
&#8216;not null&#8217; =&gt; FALSE<br />
),<br />
&#8216;works&#8217; =&gt; array(<br />
&#8216;type&#8217; =&gt; &#8216;text&#8217;,<br />
&#8216;not null&#8217; =&gt; FALSE<br />
),<br />
),<br />
&#8216;indexes&#8217; =&gt; array(<br />
&#8216;nid&#8217; =&gt; array(&#8216;nid&#8217;),<br />
),<br />
<span style="color: #ff0000;">// Version is primary key.  Could do nid, vid.</span><br />
&#8216;primary key&#8217; =&gt; array(&#8216;vid&#8217;),<br />
);<br />
<span style="color: #008000;">return</span> $schema;<br />
}</p>
<p><strong>Step 4: <span style="color: #0000ff;">personality.module</span></strong></p>
<p>// $Id$<br />
/**<br />
* Provides the Personality content type<br />
* @file<br />
*/<br />
/**<br />
* Implementation of hook_help()<br />
*/<br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_help</span>($path, $arg){<br />
if($path == &#8216;admin/help#personality&#8217;){<br />
$txt = &#8216;A personality is a description of a person\&#8217;s person.  Should include a brief summary, biography, date of birth, optionally date of death, and accomplishments.&#8217;;<br />
$replace = array();<br />
<span style="color: #008000;">return</span> &#8216;&lt;p&gt;&#8217; . <span style="color: #ff00ff;">t</span>($text, $replace) . &#8216;&lt;/p&gt;&#8217;;<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Imnplementation of hook_node_info()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality_node<span style="color: #ff00ff;">_info</span>(){<br />
<span style="color: #008000;">return</span> array(<br />
&#8216;personality&#8217; =&gt; array(<br />
&#8216;name&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Personality&#8217;),<br />
&#8216;module&#8217; =&gt; &#8216;personality&#8217;,<br />
&#8216;description&#8217; =&gt;<span style="color: #ff00ff;"> t</span>(&#8216;A personality of a person.&#8217;),<br />
&#8216;has_title&#8217; =&gt; TRUE,<br />
&#8216;title_label&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Personality of&#8217;),<br />
&#8216;has_body&#8217; =&gt; TRUE,<br />
&#8216;body_label&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Overview&#8217;),<br />
)<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_form()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_form</span>(&amp;$node){<br />
$type = node_get_types(&#8216;type&#8217;, $node);<br />
<span style="color: #ff0000;">//Existing files: title (Personality of) and body (Overview)</span><br />
if($type-&gt;has_title){<br />
$form['title'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textfield&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">check_plain</span>($type-&gt;title_label),<br />
&#8216;#required&#8217; =&gt; TRUE,<br />
&#8216;#default_value&#8217; =&gt; $node-&gt;title,<br />
&#8216;#weight&#8217; =&gt; -5,<br />
);<br />
}<br />
if($type-&gt;has_body){<br />
$form['body_field'] = <span style="color: #ff00ff;">node_body_field</span>(<br />
$node,<br />
$type-&gt;body_label,<br />
$type-&gt;min_word_count<br />
);<br />
}<br />
<span style="color: #ff0000;">// Our custom fields: Dates, Life, Works</span><br />
$form['dates'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textfield&#8217;,<br />
&#8216;#size&#8217; =&gt; 50,<br />
&#8216;#maxlength&#8217; =&gt; 127,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Dates&#8217;),<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Birth and death dates.&#8217;),<br />
&#8216;#default_value&#8217; =&gt; isset($node-&gt;dates) ? $node-&gt;dates : &#8221;,<br />
);<br />
$form['life'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textarea&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Life&#8217;),<br />
&#8216;#cols&#8217; =&gt; 50,<br />
&#8216;#rows&#8217; =&gt; 15,<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;A description of this perons\&#8217;s life.&#8217;),<br />
&#8216;#default_value&#8217; =&gt; isset($node-&gt;life) ? $node-life : &#8221;,<br />
);<br />
$form['works'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textarea&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Works&#8217;),<br />
&#8216;#cols&#8217; =&gt; 50,<br />
&#8216;#rows&#8217; =&gt; 5,<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;This person\&#8217;s Personality&#8217;),<br />
&#8216;#default_value&#8217; =&gt; isset($node-&gt;works) ? $node-&gt;works : &#8221;,<br />
);<br />
<span style="color: #008000;">return</span> $form;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_perm()<br />
* Responsible for registering new permissions<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_perm</span>(){<br />
<span style="color: #008000;">return</span> array(<br />
&#8216;create personality node&#8217;,<br />
&#8216;edit personality nodes&#8217;,<br />
&#8216;delete personality nodes&#8217;,<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_access()<br />
* which implements our new permissions<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_access</span>($op, $node, $account){<br />
switch($op){<br />
case &#8216;create&#8217;:<br />
<span style="color: #008000;">return</span> <span style="color: #ff00ff;">user_access</span>(&#8216;create personality node&#8217;, $account);<br />
case &#8216;update&#8217;:<br />
<span style="color: #008000;">return</span> <span style="color: #ff00ff;">user_access</span>(&#8216;edit personality nodes&#8217;, $account);<br />
case &#8216;delete&#8217;:<br />
<span style="color: #008000;">return</span> <span style="color: #ff00ff;">user_access</span>(&#8216;delete personality nodes&#8217;, $account);<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_insert()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_insert</span>($node){<br />
if(!isset($node-&gt;life)){<br />
$node-&gt;life = &#8221;;<br />
}<br />
if(!isset($node-&gt;works)){<br />
$node-&gt;works = &#8221;;<br />
}<br />
<span style="color: #ff00ff;">db_query</span>(<br />
&#8220;<span style="color: #008080;">INSERT INTO {personality} (vid, nid, dates, life, works) VALUES (%d, %d, &#8216;%s&#8217;, &#8216;%s&#8217;, &#8216;%s&#8217;)</span>&#8220;,<br />
$node-&gt;vid,<br />
$node-&gt;nid,<br />
$node-&gt;dates,<br />
$node-&gt;life,<br />
$node-&gt;works<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_update()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_update</span>($node){<br />
if($node-&gt;revision){<br />
personality_insert($node);<br />
}<br />
else{<br />
<span style="color: #ff00ff;">db_query</span>(<br />
&#8220;<span style="color: #008080;">UPDATE {personality} SET dates = &#8216;&amp;s&#8217;, life = &#8216;%s&#8217;, works = &#8216;%s&#8217; WHERE vid = %d</span>&#8220;,<br />
$node-&gt;dates,<br />
$node-&gt;life,<br />
$node-&gt;works,<br />
$node-&gt;vid<br />
);<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_delete()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_delete</span>($node){<br />
<span style="color: #ff00ff;">db_query</span>(<br />
&#8220;<span style="color: #008080;">DELETE FROM {personality} WHERE nid = %d</span>&#8220;,<br />
$node-&gt;nid<br />
);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* This implementation deletes node revisions<br />
* Implements hook_nodeapi()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_nodeapi</span>(&amp;$node, $op, $teaser, $page){<br />
if($op == &#8216;delete revision&#8217;){<br />
<span style="color: #ff00ff;">db_query</span>(<br />
&#8216;<span style="color: #008080;">DELETE FROM {personality} WHERE vid = %d</span>&#8216;,<br />
$node-&gt;vid<br />
);<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_load()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_load</span>($node){<br />
$result = <span style="color: #ff00ff;">db_query</span>(<br />
&#8216;<span style="color: #008080;">SELECT dates, life, works FROM {personality} WHERE vid = %d</span>&#8216;,<br />
$node-&gt;vid<br />
);<br />
<span style="color: #008000;">return</span> <span style="color: #ff00ff;">db_fetch_object</span>($result);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_view()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_view</span>($node, $teaser = FALSE, $page = FALSE){<br />
$node = <span style="color: #ff00ff;">node_prepare</span>($node, $teaser);<br />
$dates = <span style="color: #ff00ff;">check_plain</span>($node-&gt;dates);<br />
$life = <span style="color: #ff00ff;">check_markup</span>($node-&gt;life);<br />
$works = <span style="color: #ff00ff;">check_markup</span>($node-&gt;works);<br />
<span style="color: #ff0000;">// Add theme</span><br />
$node-&gt;content['personality_info'] = array(<br />
&#8216;#value&#8217; =&gt; <span style="color: #ff00ff;">theme</span>(&#8216;personality_info&#8217;, $dates, $life, $works),<br />
&#8216;#weight&#8217; =&gt; 1,<br />
);<br />
<span style="color: #008000;">return</span> $node;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_theme()<br />
*/</span><br />
<span style="color: #0000ff;">function</span> personality<span style="color: #ff00ff;">_theme</span>(){<br />
<span style="color: #008000;">return</span> array(<br />
&#8216;personality_info&#8217; =&gt; array(<br />
&#8216;template&#8217; =&gt; &#8216;personality_info&#8217;,<br />
&#8216;arguments&#8217; =&gt; array(<br />
&#8216;dates&#8217; =&gt; NULL,<br />
&#8216;life&#8217; =&gt; NULL,<br />
&#8216;works&#8217; =&gt; NULL,<br />
),<br />
),<br />
);<br />
}</p>
<p><strong>Step 5: <span style="color: #0000ff;">personality_info.tpl.php</span></strong> template theme file</p>
<p>// $Id$<br />
/**<br />
* Template to display personality nodes.<br />
*<br />
* Fields available:<br />
* $dates: cleaned plain text string<br />
* $life: cleaned HTML string<br />
* $works: cleaned HTML string<br />
*/</p>
<p>&lt;div&gt;<br />
&lt;h2&gt;<span style="color: #ff0000;">&lt; ? php</span> print <span style="color: #ff00ff;">t</span>(&#8216;Dates&#8217;); <span style="color: #ff0000;">? &gt;</span>:&lt;/h2&gt;<br />
<span style="color: #ff0000;">&lt; ? php</span> print $dates; <span style="color: #ff0000;">? &gt;</span><br />
&lt;h2&gt;<span style="color: #ff0000;">&lt; ? php</span> print <span style="color: #ff00ff;">t</span>(&#8216;Life&#8217;);<span style="color: #ff0000;"> ? &gt;</span>:&lt;/h2&gt;<br />
<span style="color: #ff0000;">&lt; ? php</span> print $life; <span style="color: #ff0000;">? &gt;</span><br />
&lt;h2&gt;<span style="color: #ff0000;">&lt; ? php</span> print<span style="color: #ff00ff;"> t</span>(&#8216;Works&#8217;);<span style="color: #ff0000;"> ? &gt;</span>:&lt;/h2&gt;<br />
<span style="color: #ff0000;">&lt; ? php</span> print $works; <span style="color: #ff0000;">? &gt;</span><br />
&lt;/div&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/drupal-notes-6-module-new-content-type-non-cck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Notes 5: admin module emails users from profile: hook_mail(), hook_mail_alter(), hook_help(), hook_menu(), Forms API, hook_user()</title>
		<link>http://alexyz.com/drupal-notes-5-admin-module-emails-users-from-profile-hook_mail-hook_mail_alter-hook_help-hook_menu-forms-api-hook_user/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-notes-5-admin-module-emails-users-from-profile-hook_mail-hook_mail_alter-hook_help-hook_menu-forms-api-hook_user</link>
		<comments>http://alexyz.com/drupal-notes-5-admin-module-emails-users-from-profile-hook_mail-hook_mail_alter-hook_help-hook_menu-forms-api-hook_user/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 00:30:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=505</guid>
		<description><![CDATA[For this module it&#8217;s best that your development environment is configured to send live emails. If it&#8217;s local, xampp perhaps, and not currently configured as such, you may want to refer to this post first: http://alexyz.com/sending-mail-xampp-gmail/ Step 1, of course, create a new folder entitled emailusers in sites/all/modules Step 2, in that folder, create emailusers.info, [...]]]></description>
			<content:encoded><![CDATA[<p>For this module it&#8217;s best that your development environment is configured to send live emails.<br />
If it&#8217;s local, xampp perhaps, and not currently configured as such,<br />
you may want to refer to this post first:<br />
<a href="http://alexyz.com/sending-mail-xampp-gmail/">http://alexyz.com/sending-mail-xampp-gmail/</a></p>
<p><strong>Step 1</strong>, of course, create a <strong>new folder entitled <span style="color: #0000ff;">emailusers</span></strong> in <strong>sites/all/modules</strong></p>
<p><strong>Step 2</strong>, in that folder, <strong>create <span style="color: #0000ff;">emailusers.info</span></strong>, containing the following<br />
<em>(if you&#8217;ve read Notes 1-4 this should all be very familiar already)</em>:</p>
<p><span style="color: #ff0000;">;$Id$</span><br />
name = &#8220;emailusers&#8221;<br />
description = &#8220;admin module for emailing users from within their profile&#8221;<br />
core = 6.x<br />
php = 5.1</p>
<p><strong>Step 3</strong>, <strong>create <span style="color: #0000ff;">emailusers.module</span></strong> in same folder, contents thereof follow:</p>
<p><span style="color: #ff0000;">// $Id$<br />
/**<br />
* This module provides an email interface for administrators.<br />
* Using this module, administrators can send email to a user from the<br />
* user&#8217;s &#8220;view&#8221; page.<br />
* @file<br />
*/<br />
<span style="color: #ff0000;">/**</span></span><span style="color: #ff0000;"><br />
* Implementation hook_help()<br />
*/</span><br />
function emailusers<span style="color: #ff00ff;">_help</span>($path, $arg){<br />
if($path == &#8216;admin/help#emailusers&#8217;){<br />
$txt = &#8216;This module provides a way for an administrator to send&#8217;<br />
. &#8216;email to a user. &#8216;<br />
. &#8216;It assumes that the Drupal mailer is configured.&#8217;;<br />
return &#8216;&lt;p&gt;&#8217; . t($txt) . &#8216;&lt;/p&gt;&#8217;;<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_munu()<br />
*/</span><br />
function emailusers<span style="color: #ff00ff;">_menu</span>(){<br />
<span style="color: #ff0000;">// Need to pass User ID via placeholder %,<br />
// thus URL will be available here: ?q=admin/emailusers/compose/userIdHere</span><br />
$items['admin/emailusers/compose/<span style="color: #ff00ff;">%</span>'] = array(<br />
&#8216;title&#8217; =&gt; &#8216;Compose a Message&#8217;,<br />
&#8216;page callback&#8217; =&gt; &#8216;emailusers_compose&#8217;,<br />
&#8216;page arguments&#8217; =&gt; <span style="color: #ff00ff;">array(3)</span>, <span style="color: #ff0000;">// &lt;- userId (from % in node path)</span><br />
&#8216;access arguments&#8217; =&gt; array(&#8216;administer users&#8217;),<br />
&#8216;type&#8217; =&gt; <span style="color: #ff00ff;">MENU_CALLBACK</span>,<br />
);<br />
return $items;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Compose a message.<br />
* This creates the form necessary to compose an email message.<br />
*<br />
* @param $to<br />
* The address to send to.<br />
* @return<br />
* HTML.<br />
*/</span><br />
function emailusers<span style="color: #ff00ff;">_compose</span>($userid){<br />
$userid =<span style="color: #ff00ff;"> intval</span>($userid);<br />
if($userid == 0){<br />
return <span style="color: #ff00ff;">t</span>(&#8216;User ID must be an integer.&#8217;);<br />
}<br />
$account = <span style="color: #ff00ff;">user_load</span>($userid);<br />
if(<span style="color: #008000;">empty</span>($account)){<br />
return <span style="color: #ff00ff;">t</span>(&#8216;No such user found.&#8217;);<br />
}<br />
$to = $account-&gt;mail;<br />
$sb = &#8216;&lt;p&gt;&#8217;<br />
. <span style="color: #ff00ff;">t</span>(&#8216;Send a message to @email.&#8217;, array(&#8216;@email&#8217; =&gt; $to))<br />
. &#8216;&lt;/p&gt;&#8217;;<br />
$sb .= <span style="color: #ff00ff;">drupal_get_form</span>(&#8216;emailusers_compose_form&#8217;, <span style="color: #ff00ff;">$account</span>);<br />
<span style="color: #ff0000;">// <span style="color: #008000;">Forms API / FAPI</span><br />
// <span style="color: #008000;">http://drupal.org/node/751826</span><br />
// <span style="color: #008000;">http://api.drupal.org/api/drupal/developer&#8211;topics&#8211;forms_api_reference.html/6</span></span><br />
return $sb;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Form constructor<br />
*/</span><br />
function emailusers_compose<span style="color: #ff00ff;">_form</span>($context, <span style="color: #ff00ff;">$account</span>){<br />
<span style="color: #ff0000;">// This is a value only &#8212; equivalent to a hidden field<br />
// except that it is never renered into the HTML</span><br />
<span style="color: #ff0000;"><span style="color: #ff00ff;">$form['to']</span> </span>= array(<br />
&#8216;#type&#8217; =&gt; &#8216;value&#8217;,<br />
&#8216;#value&#8217; =&gt; $account,<br />
);<br />
<span style="color: #ff0000;">// Create a fieldset for the body:</span><br />
$form['message'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;fieldset&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Compose the Message&#8217;),<br />
);<br />
<span style="color: #ff0000;">// Textfield for subject of the body</span><br />
$form['message']['subject'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textfield&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Subject&#8217;),<br />
&#8216;#size&#8217; =&gt; 50,<br />
&#8216;#maxlength&#8217; =&gt; 255,<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;The subject of the email message.&#8217;),<br />
);<br />
<span style="color: #ff0000;">// And a text area for the body.</span><br />
$form['message']['body'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;textarea&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Message&#8217;),<br />
&#8216;#cols&#8217; =&gt; 50,<br />
&#8216;#rows&#8217; =&gt; 5,<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;The body of the email message.&#8217;),<br />
);<br />
<span style="color: #ff0000;">// Create a fieldset for details</span><br />
$form['details'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;fieldset&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8220;Details&#8221;),<br />
);<br />
<span style="color: #ff0000;">// Checkbox: if checked, CC the author too</span><br />
$form['details']['cc_me'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;checkbox&#8217;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;BCC Yourself&#8217;),<br />
&#8216;#default_value&#8217; =&gt; 1,<br />
&#8216;#description&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;If this is checked, the message will also be sent to you.&#8217;),<br />
);<br />
<span style="color: #ff0000;">// Finally, a submit button:</span><br />
$form['submit'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;submit&#8217;,<br />
&#8216;#value&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Send Mail&#8217;),<br />
);<br />
return $form;<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Form submission handler, which functions like a hook.<br />
* Note that the params $form and &amp;$form_state are new in D6.<br />
* They replace $form_id and $form_values.<br />
*/</span><br />
function emailusers_compose_form<span style="color: #ff00ff;">_submit</span>($form, &amp;$form_state){<br />
$form_values = $form_state['values'];<br />
$account = $form_values['to'];<br />
<span style="color: #ff00ff;">drupal_mail</span>(<br />
&#8216;emailusers&#8217;,<br />
&#8216;composemessage&#8217;,<br />
$account-&gt;mail,<br />
<span style="color: #ff00ff;">user_preferred_language</span>($account),<br />
$form_values,<br />
<span style="color: #ff00ff;">variable_get</span>(&#8216;site_mail&#8217;, null),<br />
true<span style="color: #ff0000;"> // Automatically send</span><br />
);<br />
<span style="color: #ff0000;">// drupal_mail will invoke hook_mail(), or in this case, emailusers_mail(), below</span><br />
$form_state['redirect'] = <span style="color: #008000;">sprintf</span>(&#8216;user/%d&#8217;, $account-&gt;uid);<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_mail()<br />
*/</span><br />
function emailusers<span style="color: #ff00ff;">_mail</span>($key, &amp;$message, $params){<br />
<span style="color: #ff0000;">// Just catch calls to this hook from compose form.</span><br />
if ($key == &#8216;composemessage&#8217;){<br />
$language = $params['language'];<br />
$account = $params['to'];<br />
if($params['cc_me']){<br />
<span style="color: #ff0000;">// Look up current user&#8217;s email address:<br />
//$my_account = user_load(null);</span><br />
$message['headers']['bcc'] = <span style="color: #ff00ff;">$GLOBALS['user']-&gt;mail</span>;<br />
}<br />
$message['to'] = $account-&gt;mail;<br />
$message['subject'] = <span style="color: #ff00ff;">t</span>(&#8216;Drupal Message: &#8216;, array(), $language-&gt;language);<br />
<span style="color: #ff0000;">// If these were automatically-generated messages<br />
// they should be run through t()<br />
// but since text is user-entered<br />
// don&#8217;t use t()</span><br />
$message['subject'] .= $params['subject'];<br />
<span style="color: #ff0000;">//$message['body'] = $params['body'];</span><br />
$message['body'][] = $params['body'];<br />
}<br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implements hook_mail_alter()<br />
* !! Note: similar, and also of interest are hook_link_alter() &amp; hook_menu_alter()<br />
* simply put, _alter hooks alter data right after their parent hooks are called, but before output<br />
* also important to note: this _alter() below will augment ALL emails sent to the Mail API<br />
* not just those from this module!<br />
*/</span><br />
function emailusers_mail<span style="color: #ff00ff;">_alter</span>(&amp;$message){<br />
$append = &#8220;\n==================================\n&#8221;<br />
. &#8220;This message was sent from !site_name (!website). &#8221;<br />
. &#8220;If you believe this message to be a case of abuse, &#8221;<br />
. &#8220;please contact !site_email.\n&#8221;;<br />
$args = array(<br />
&#8216;!website&#8217; =&gt; <span style="color: #ff00ff;">url</span>(&#8221;, array(&#8216;absolute&#8217; =&gt; true)),<br />
&#8216;!site_email&#8217; =&gt; variable_get(&#8216;site_mail&#8217;, null),<br />
&#8216;!site_name&#8217; =&gt; variable_get(&#8216;site_name&#8217;, &#8216;Unknown&#8217;),<br />
);<br />
<span style="color: #000000;">$message['body'] .= t($append, $args);</span><br />
<span style="color: #ff0000;">//$message['body'][] = t($append, $args);</span><br />
}<br />
<span style="color: #ff0000;">/**<br />
* Implementation of hook_user().<br />
*/</span><br />
function emailusers<span style="color: #ff00ff;">_user</span>($op, &amp;$edit, &amp;$account, $category){<br />
if($op == &#8216;view&#8217; &amp;&amp; <span style="color: #ff00ff;">user_access</span>(&#8216;<span style="color: #ff00ff;">administer users</span>&#8216;)){<br />
<span style="color: #ff0000;">// Create the outer &#8220;block&#8221;</span><br />
$account-&gt;content['EmailUsers'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;<span style="color: #ff00ff;">user_profile_category</span>&#8216;,<br />
&#8216;#attributes&#8217; =&gt; array(&#8216;class&#8217; =&gt; &#8216;user-member&#8217;),<br />
&#8216;#weight&#8217; =&gt; 0,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Contact user&#8217;),<br />
);<br />
<span style="color: #ff0000;">// Create the content of the block</span><br />
$account-&gt;content['EmailUsers']['EmailLink'] = array(<br />
&#8216;#type&#8217; =&gt; &#8216;<span style="color: #ff00ff;">user_profile_item</span>&#8216;,<br />
&#8216;#title&#8217; =&gt; <span style="color: #ff00ff;">t</span>(&#8216;Send a message to this user from the site administrator.&#8217;),<br />
&#8216;#value&#8217; =&gt; <span style="color: #ff00ff;">l</span>(<br />
&#8216;Email&#8217;,<br />
&#8216;admin/emailusers/compose/&#8217; . $account-&gt;uid<br />
),<br />
);<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/drupal-notes-5-admin-module-emails-users-from-profile-hook_mail-hook_mail_alter-hook_help-hook_menu-forms-api-hook_user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Notes 4: enhance our module with jQuery AJAX/JSON</title>
		<link>http://alexyz.com/drupal-notes-4-enhance-our-module-with-jquery-ajaxjson/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-notes-4-enhance-our-module-with-jquery-ajaxjson</link>
		<comments>http://alexyz.com/drupal-notes-4-enhance-our-module-with-jquery-ajaxjson/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 20:16:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=494</guid>
		<description><![CDATA[create quoteDisplay.js to contain: var quoteDisplay = {}; // JS Namespace Object Creation if(Drupal.jsEnabled){ $(document).ready( function(){ $(&#8220;#quoteDisplay-origin&#8221;).after(&#8220;&#60;a&#62;Next &#38;raquo;&#60;/a&#62;&#8221;).next().click(quoteDisplay.randQuote); } ); /** * A function to fetch quotes from the server, * and display in the designated area. */ quoteDisplay.randQuote = function(){ $.get(Drupal.settings.quoteDisplay.json_url, function(data){ myQuote = Drupal.parseJson(data); if(!myQuote.status &#124;&#124; myQuotes.status == 0){ $(&#8220;#quoteDisplay-origin&#8221;).text(myQuote.quote.origin); $(&#8220;#quoteDisplay-text&#8221;).text(myQuote.quote.text); } }); [...]]]></description>
			<content:encoded><![CDATA[<p><strong>create <span style="color: #008000;">quoteDisplay.js</span></strong> to contain:</p>
<p>var quoteDisplay = {}; <span style="color: #ff0000;">// JS Namespace Object Creation</span><br />
if(<span style="color: #ff00ff;">Drupal.jsEnabled</span>){<br />
<span style="color: #0000ff;">$</span>(document).ready(<br />
<span style="color: #008000;">function</span>(){<br />
<span style="color: #0000ff;">$</span>(&#8220;#quoteDisplay-origin&#8221;)<span style="color: #0000ff;">.after</span>(&#8220;&lt;a&gt;Next &amp;raquo;&lt;/a&gt;&#8221;)<span style="color: #0000ff;">.next().click</span>(quoteDisplay.randQuote);<br />
}<br />
);<br />
<span style="color: #ff0000;">/**<br />
* A function to fetch quotes from the server,<br />
* and display in the designated area.<br />
*/</span><br />
quoteDisplay.randQuote =<span style="color: #008000;"> function</span>(){<br />
<span style="color: #0000ff;">$.get</span>(<span style="color: #ff00ff;">Drupal.settings.quoteDisplay.json_url</span>, <span style="color: #008000;">function</span>(data){<br />
myQuote = <span style="color: #ff00ff;">Drupal.parseJson(data)</span>;<br />
if(!myQuote.status || myQuotes.status == 0){<br />
<span style="color: #0000ff;">$</span>(&#8220;#quoteDisplay-origin&#8221;)<span style="color: #0000ff;">.text</span>(myQuote.quote.origin);<br />
<span style="color: #0000ff;">$</span>(&#8220;#quoteDisplay-text&#8221;)<span style="color: #0000ff;">.text</span>(myQuote.quote.text);<br />
}<br />
}); <span style="color: #ff0000;">// End inline function</span><br />
}<br />
}</p>
<p><strong>add this line</strong> to <strong><span style="color: #008000;">quoteDisplay.module</span> </strong>file&#8217;s<strong> theme_quoteDisplay()</strong> function (after &#8220;drupal_add_js&#8221; line, before &#8220;$output = &#8216;</p>
<p><span style="color: #ff00ff;">drupal_add_js</span>($module_path . &#8216;/quoteDisplay.js&#8217;);<br />
$opts = array(&#8216;absolute&#8217; =&gt; TRUE);<br />
$json_url = <span style="color: #ff00ff;">url</span>(&#8216;quoteDisplay.json&#8217;, $opts);<br />
<span style="color: #ff00ff;">drupal_add_js</span>(<br />
array(&#8216;quoteDisplay&#8217; =&gt;<br />
array(&#8220;json_url&#8221; =&gt; $json_url)), &#8216;<span style="color: #ff00ff;">setting</span>&#8216;);</p>
<p><strong>also add these function</strong>s to our <span style="color: #008000;"><strong>quoteDisplay.module</strong></span> file:</p>
<p><span style="color: #ff0000;">/*<br />
* Callback to handle requests for </span>quoteDisplay<span style="color: #ff0000;"> content.<br />
* @return<br />
* JSON data.<br />
*/</span><br />
<span style="color: #008000;">function</span> quoteDisplay_item(){<br />
$item = _quoteDisplay_get_quote();<br />
<span style="color: #ff00ff;">drupal_set_header</span>(&#8216;Content-Type: text/plain; charset: utf-8&#8242;);<br />
printf(<br />
&#8216;<span style="color: #ff0000;">{ &#8220;quote&#8221;: { &#8220;origin&#8221;: &#8220;%s&#8221;, &#8220;text&#8221;: &#8220;%s&#8221; } }</span>&#8216;,<br />
$item-&gt;title,<br />
$item-&gt;body<br />
);<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Implementation of hook_menu()<br />
* registers quoteDisplay.json<br />
* will call quoteDisplay_item() when called<br />
* anyone that may access content may access this path<br />
* MENU_CALLBACK below is a bitmask,<br />
* that doesn&#8217;t authomatically create links to this item in the menu or elsewhere,<br />
* it simnply makes this accessible by URL,<br />
* more than 20 such bitmask types may be used,<br />
* see documentation.<br />
*/</span><br />
<span style="color: #000000;"><span style="color: #008000;">function</span> quoteDisplay_menu(){</span><br />
$items['quoteDisplay.json'] = array(<br />
&#8216;title&#8217; =&gt; &#8216;Quote Display AJAX Gateway&#8217;,<br />
&#8216;page callback&#8217; =&gt; &#8216;quoteDisplay_item&#8217;,<br />
&#8216;access arguments&#8217; =&gt; array(&#8216;access content&#8217;),<br />
&#8216;type&#8217; =&gt; <span style="color: #ff0000;">MENU_CALLBACK</span>,<br />
);<br />
<span style="color: #008000;">return</span> $items;<br />
}</p>
<p><span style="color: #008000;">now hit the url to see your JSON return! (you may need to clear your drupal cache of course)<br />
<strong>http://localhost/yourDrupalSiteName/?q=quoteDisplay.json</strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/drupal-notes-4-enhance-our-module-with-jquery-ajaxjson/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Notes 3: a themed module for a new content type</title>
		<link>http://alexyz.com/drupal-notes-3-a-themed-module-for-a-new-content-type/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-notes-3-a-themed-module-for-a-new-content-type</link>
		<comments>http://alexyz.com/drupal-notes-3-a-themed-module-for-a-new-content-type/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 07:11:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=491</guid>
		<description><![CDATA[create a new content type, create some entries create a new theme (see earlier notes for how) quoteDisplay.info contains the following: ; $Id$ name = &#8220;Quote Display&#8221; description = &#8220;Dynamic display of  quotes.&#8221; core = 6.x php = 5.1 quoteDisplay.module contains this: // $Id$ /** * @file * Module for dynamic display of pithy philosophy [...]]]></description>
			<content:encoded><![CDATA[<p><strong>create</strong> a new <span style="color: #008000;">content type</span>, create some entries<br />
<strong>create</strong> a new theme (see earlier notes for how)</p>
<p><strong>quoteDisplay.info</strong> contains the following:</p>
<p><span style="color: #008000;"><span style="color: #ff0000;">; $Id$</span><br />
name = &#8220;Quote Display&#8221;<br />
description = &#8220;Dynamic display of  quotes.&#8221;<br />
core = 6.x<br />
php = 5.1</span></p>
<p><strong>quoteDisplay.module</strong> contains this:</p>
<p>// $Id$<br />
/**<br />
* @file<br />
* Module for dynamic display of pithy philosophy quotes.<br />
*/</p>
<p><span style="color: #ff0000;">/**<br />
* Implementation of hook_help()<br />
*/</span><br />
function quoteDisplay_help($path, $arg)<br />
{<br />
if ($path == &#8216;admin/help#quoteDisplay&#8217;)<br />
{<br />
$txt = &#8216;This module displays philosophical quotes in blocks. &#8216; .<br />
&#8216;It assumes the existence of a content type named &#8220;quote&#8221;.&#8217;;<br />
return &#8216;&lt;p&gt;&#8217; . t($txt) . &#8216;&lt;/p&gt;&#8217;;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Implementation of hook_block()<br />
*/</span><br />
function quoteDisplay_block($op = &#8216;list&#8217;, $delta = 0, $edit = array())<br />
{<br />
switch($op)<br />
{<br />
case &#8216;list&#8217;:<br />
$blocks[0]['info'] = t(&#8216;Philosophical Quotes&#8217;);<br />
return $blocks;<br />
case &#8216;view&#8217;:<br />
$item = _quoteDisplay_get_quote();<br />
if(!empty($item))<br />
{<br />
$content = theme(&#8216;quoteDisplay_quote&#8217;,<br />
check_plain($item-&gt;body),<br />
check_plain($item-&gt;title));<br />
$blocks['subject'] = t(&#8216;Pithy Quote&#8217;);<br />
$blocks['content'] = $content;<br />
return $blocks;<br />
}<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/*<br />
* Return a quote from the Drupal database<br />
*/</span><br />
function _quoteDisplay_get_quote()<br />
{<br />
<span style="color: #ff00ff;">$sql = &#8220;SELECT nid FROM {node} &#8220;.<br />
&#8220;WHERE status = 1 AND type = &#8216;quote&#8217; ORDER BY RAND() LIMIT 1&#8243;;<br />
$res = db_query($sql);<br />
$item = db_fetch_object($res);<br />
$quote = node_load($item-&gt;nid);<br />
return $quote;</span><br />
}<br />
<span style="color: #ff0000;"><br />
/*<br />
* Implementation of hook_theme().<br />
*/</span><br />
function quoteDisplay_theme()<br />
{<br />
return array(<br />
&#8216;quoteDisplay_quote&#8217; =&gt; array(<br />
&#8216;arguments&#8217; =&gt; array(<br />
&#8216;text&#8217; =&gt; NULL,<br />
&#8216;origin&#8217; =&gt; NULL<br />
),<br />
),<br />
);<br />
}</p>
<p><span style="color: #ff0000;">/*<br />
* Theme function for theming quotes.<br />
*<br />
* @param $text<br />
* The quote content as a string.<br />
* @param $origin<br />
* The original source of the quote, as a string.<br />
* @return<br />
* An HTML themed string.<br />
*/</span><br />
function theme_quoteDisplay_quote($text, $origin)<br />
{<br />
$module_path = <span style="color: #ff00ff;">drupal_get_path(&#8216;module&#8217;,&#8217;</span>quoteDisplay<span style="color: #ff00ff;">&#8216;)</span>;<br />
$full_path = $module_path . &#8216;/quoteDisplay.css&#8217;;<br />
<span style="color: #ff00ff;">drupal_add_css($full_path);</span><br />
$output = &#8216;&lt;div id=&#8221;quoteDisplay-text&#8221;&gt;&#8217; . t($text) . &#8216;&lt;/div&gt;&lt;div id=&#8221;quoteDisplay-origin&#8221;&gt;&#8217; . t($origin) . &#8216;&lt;/div&gt;&#8217;;<br />
return $output;<br />
}</p>
<p><strong>quoteDisplay</strong><strong>.css</strong> (also in /sites/all/modules/quoteDisplay) contains:</p>
<p>#quoteDisplay-text:first-letter{<br />
font-size:18pt;<br />
font-weight:bold;<br />
}<br />
#quoteDisplay-origin{<br />
font-style: oblique;<br />
text-align: right;<br />
margin-right: 5px;<br />
}</p>
<p>Note:</p>
<p>This module thus has a default &#8220;theme&#8221; of its own.  This may be overridden via CSS, or via a quoteDisplay.tpl.php file placed within the themes/module/currentTheme folder</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/drupal-notes-3-a-themed-module-for-a-new-content-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Notes 2: sub-theme derivative of bluemarine : Theme inheritance, overriding, preprocessing</title>
		<link>http://alexyz.com/drupal-notes-2-sub-theme-derivative-of-bluemarine-minor-css-changes-only-theme-inheritance-overriding/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-notes-2-sub-theme-derivative-of-bluemarine-minor-css-changes-only-theme-inheritance-overriding</link>
		<comments>http://alexyz.com/drupal-notes-2-sub-theme-derivative-of-bluemarine-minor-css-changes-only-theme-inheritance-overriding/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 01:22:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=482</guid>
		<description><![CDATA[add folder to: sites/all/themes(createThis)/subThemeName(createThis)/ create subThemeName.info (in newly created folder): ; $Id$ name = subThemeName description = blah blah blah blah blah version = 1.0 core = 6.x base theme = bluemarine stylesheets[all][] = descartes-style.css // copy images from parent theme into sub-theme. stylesheets[all][] = new.css finally, create above mentioned new.css (in newly created folder) [...]]]></description>
			<content:encoded><![CDATA[<p><strong>add folder to:</strong><br />
sites/all/themes(createThis)/subThemeName(createThis)/</p>
<p><strong>create <span style="color: #ff0000;">subThemeName.info</span> (in newly created folder):</strong><br />
<span style="color: #ff0000;">; $Id$</span><br />
name = subThemeName<br />
description = blah blah blah blah blah<br />
version = 1.0<br />
core = 6.x<br />
base theme = <strong>bluemarine</strong><br />
stylesheets[all][] = descartes-style.css <span style="color: #ff0000;">// copy images from parent theme into sub-theme.</span><br />
stylesheets[all][] = new.css</p>
<p><strong>finally, create above mentioned <span style="color: #ff0000;">new.css</span> (</strong><strong>in newly created folder) </strong><strong>and add styles you&#8217;d like to modify, example:</strong><br />
<span style="color: #ff0000;">/*<br />
** Style to override the styles.css in<br />
** bluemarine.css<br />
*/</span></p>
<p><span style="color: #ff0000;">/*<br />
* Plain white right nav.<br />
*/</span><br />
#sidebar-right{<br />
border-left: 1px solid #ea940c;<br />
background-color: white;<br />
}</p>
<p><strong>ready to go further? copy any of the following over from bluemarine into yourNewSubTheme and edit away:</strong><br />
<span style="color: #008000;">page.tpl.php</span> (<span style="color: #ff0000;">hint: start here</span>), <span style="color: #008000;">block.tpl.php</span>, <span style="color: #008000;">box.tpl.php</span>, <span style="color: #008000;">comment.tpl.php</span></p>
<p><strong>even further, you&#8217;ve moved $breadcrumb in <span style="color: #008000;">page.tpl.php</span> to where you&#8217;d like it, but you want to edit INSIDE that&#8230;</strong><br />
these <span style="color: #008000;">PHPTemplate functions</span> that render content can be found in <span style="color: #008000;">yourSite/includes/theme.inc</span><br />
find the one that spits out the content you&#8217;d like to modify, and then create a template.php in your new theme directory and override that function&#8230;<br />
example: <span style="color: #008000;">theme_breadcrumb()</span> uses<span style="color: #ffcc00;"> <strong><span style="color: #000000;">&#8220;&gt;&gt;&#8221;</span></strong></span><strong><span style="color: #000000;"> </span></strong>as separators, in<br />
<span style="color: #008000;">yourSite/sites/all/themes/yourNewTheme/template.php</span> (make it)<br />
overwrite <span style="color: #008000;">theme_breadcrumb()</span> via something like this:</p>
<p><span style="color: #ff0000;"><br />
// $Id$<br />
/**<br />
* @page<br />
* Override theme_() functions for the youNewTheme.<br />
*/</span></p>
<p><span style="color: #ff0000;">// Overrides theme_breadcrumb()</span><br />
function<span style="color: #008000;"> phptemplate_</span>breadcrumb($breadcrumb){<br />
if (empty($breadcrumb)) return;<br />
$sep = &#8216;&lt;div&gt;<span style="color: #000000;"><strong>&amp;nbsp;&amp;nbsp;</strong></span>&lt;/div&gt;&#8217;;<br />
$breadcrumb_string = &#8216;&lt;div&gt;&#8217; . implode($sep, $breadcrumb) . &#8216;&lt;/div&gt;&#8217;;<br />
return $breadcrumb_string;<br />
} <span style="color: #ff0000;">// end of template.php example</span></p>
<p>other <span style="color: #008000;">PHPTemplate theme functions</span> from <span style="color: #008000;">includes/theme.inc</span> to investigate:<br />
<span style="color: #008000;">theme_image()</span>, <span style="color: #008000;">theme_links()</span>,<span style="color: #008000;"> theme_progress_bar()</span>, <span style="color: #008000;">theme_username()</span>,<span style="color: #008000;"> theme_table()<span style="color: #000000;">,</span> theme_item_list()<br />
</span><br />
<strong>called as follows:</strong><br />
$variable = theme(&#8216;functionName&#8217;, $arg1, $arg2, &#8230;) , <strong>which looks like this:</strong><br />
$crumb = theme(&#8216;item_list&#8217;, $breadcrumb, null, &#8216;ul&#8217;, array(&#8216;class&#8217;=&gt;&#8217;breadcrumb-items&#8217;));</p>
<p><span style="color: #ff0000;">IMPORTANT NOTES/REMEMBER</span>:<br />
- a <span style="color: #ff0000;">phptemplate_block()</span> function redefined in <span style="color: #ff0000;">template.php</span> will <strong>override</strong> a <span style="color: #ff0000;">block.tpl.php </span>file in template folder!<br />
- if you want to preprocess CONTENT before it&#8217;s passed to template.php, thus, instead use <span style="color: #ff0000;">phptemplate_preprocess_functions()</span>!<br />
- if you&#8217;re <strong>NOT </strong>making a sub-theme, add to .info this line: <span style="color: #ff0000;">engine=phptemplate</span> instead of using the base theme line<br />
- don&#8217;t forget to make a nice <span style="color: #ff0000;">screenshot.png</span> (150&#215;90)</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/drupal-notes-2-sub-theme-derivative-of-bluemarine-minor-css-changes-only-theme-inheritance-overriding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Notes 1: module hook_block(), hook_help(), check_plain(), check_url(), watchdog(), t(), l(), placeholders(!,%,@)</title>
		<link>http://alexyz.com/drupal-notes-1-module-hook_block-hook_help-check_plain-check_url-watchdog-t-l-placeholders/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-notes-1-module-hook_block-hook_help-check_plain-check_url-watchdog-t-l-placeholders</link>
		<comments>http://alexyz.com/drupal-notes-1-module-hook_block-hook_help-check_plain-check_url-watchdog-t-l-placeholders/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 21:12:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=473</guid>
		<description><![CDATA[Create: moduleName.info &#38; moduleName.info, save them in sites, all, modules .info example content: ;$Id$ // This will be substituted by Drupal CVS name = &#8220;ModuleNameHere&#8221; description = &#8220;Displays items blah blah blah&#8221; core = 6.x php = 5.1 .module beginnings&#8230;: // $Id$ // This will be substituted by Drupal CVS /** * @file // This [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Create:</strong><br />
<span style="color: #008000;">moduleName.info</span> &amp; <span style="color: #008000;">moduleName.info</span>, save them in sites, all, modules</p>
<p><strong>.info example content:</strong><br />
<span style="color: #ff0000;">;$Id$</span> <span style="color: #ff00ff;">// This will be substituted by Drupal CVS</span><br />
name = &#8220;ModuleNameHere&#8221;<br />
description = &#8220;Displays items blah blah blah&#8221;<br />
core = 6.x<br />
php = 5.1</p>
<p><strong>.module beginnings&#8230;:</strong><br />
<span style="color: #ff0000;">// $Id$ </span> <span style="color: #ff00ff;">// This will be substituted by Drupal CVS</span><br />
<span style="color: #ff0000;">/**<br />
* @file</span> <span style="color: #ff00ff;">// This denotes that this comment refers to this whole file</span><br />
<span style="color: #ff0000;">* Description Here Of</span> <span style="color: #ff0000;">Module&#8230;</span><br />
<span style="color: #ff0000;">* @see http://www.goodreads.com</span><span style="color: #ff00ff;"> // Drupal doc is generated by doxygen, this links to a ref</span><br />
<span style="color: #ff0000;">*/</span></p>
<p><span style="color: #ff0000;">/**<br />
* Implementation of hook_block()<br />
*/</span><br />
<span style="color: #008000;">function</span> moduleName<span style="color: #ff00ff;">_block</span>(<span style="color: #008000;">$op=&#8217;list&#8217;, $delta=0, $edit=array()</span>){<br />
switch($op){<br />
case &#8216;list&#8217;:<br />
<span style="color: #ff00ff;">$blocks[0]['info'] </span>= <span style="color: #ff00ff;">t(</span>&#8216;Module Info Title&#8217;<span style="color: #ff00ff;">)</span>;<br />
return $blocks;<br />
case &#8216;view&#8217;:<br />
$url = &#8216;http://www.moduleXML.com/review/list_rss/&#8217;;<br />
<span style="color: #ff00ff;">$blocks['subject']</span> = <span style="color: #ff00ff;">t(</span>&#8216;Module Subject&#8217;<span style="color: #ff00ff;">)</span>;<br />
<span style="color: #ff00ff;">$blocks['content'] </span>= &#8220;Module Content Dynamic or Static&#8230;&#8221;;<br />
return $blocks;<br />
}<br />
}</p>
<p><span style="color: #ff0000;">/**<br />
* Implementation of hook_help()<br />
*/</span><br />
<span style="color: #008000;">function</span> moduleName<span style="color: #ff00ff;">_help</span>($path, $arg){<br />
if($path == &#8216;admin/help#moduleName){<br />
$txt = &#8216;The moduleName module uses the <span style="color: #008000;">!subThisHolder_url</span> API &#8216;;<br />
$link = <span style="color: #ff00ff;">l(</span>&#8216;copyForTheAnchorTag&#8217;, &#8216;http://www.moduleName.com&#8217;<span style="color: #ff00ff;">)</span>;<br />
<span style="color: #ff00ff;">$replace = array(</span>&#8216;<span style="color: #008000;">!subThisHolder_url</span>&#8216; =&gt; $link<span style="color: #ff00ff;">)</span>;<br />
return &#8216;&lt;p&gt;&#8217; . <span style="color: #ff00ff;">t(</span>$txt, $replace<span style="color: #ff00ff;">) </span>. &#8216;&lt;/p&gt;&#8217;;<br />
}<br />
}<span style="color: #ff00ff;"> //end of example .module code&#8230;</span></p>
<p><strong>Other things useful of note:</strong></p>
<p><span style="color: #ff00ff;"><span style="color: #000000;">The watchdog() function:</span></span> <a href="http://api.drupal.org/api/function/watchdog/6">http://api.drupal.org/api/function/watchdog/6</a><br />
<span style="color: #ff00ff;">watchdog(</span>&#8216;loggingCategoryNameThisModuleNameMostLikely&#8217;, $msg, $varsToSubIntoMsg, WATCHDOG_WARNING<span style="color: #ff00ff;">)</span>:<br />
logging options:<br />
WATCHDOG_EMERG<br />
WATCHDOG_ALERT<br />
WATCHDOG_CRITICAL<br />
WATCHDOG_ERROR<br />
WATCHDOG_WARNING<br />
WATCHDOG_NOTICE<br />
WATCHDOG_INFO<br />
WATCHDOG_DEBUG</p>
<p><strong>check_plain()</strong> &#8211; <a href="http://api.drupal.org/api/function/check_plain/6">http://api.drupal.org/api/function/check_plain/6</a></p>
<p><strong>check_url() </strong>- <a href="http://api.drupal.org/api/function/check_url/6">http://api.drupal.org/api/function/check_url/6</a></p>
<p><strong>t()</strong> example:</p>
<p><span style="color: #ff00ff;">t(</span>&#8216;Replacing %value by !urlHere for @emailPerhaps &#8216;, array(&#8216;%value&#8217;=&gt;&#8217;test&#8217;, &#8216;@emailPerhaps&#8217;=&gt;$email, &#8216;!urlHere&#8217;=&gt;&#8217;http://blah.com&#8217;<span style="color: #ff00ff;">)</span><span style="color: #ff00ff;">;</span></p>
<p><span style="color: #ff00ff;">!placeholders</span> replaced as is, <span style="color: #ff00ff;">@placeholders</span> replaced effectively &#8220;escaped by&#8221; check_plain(), <span style="color: #ff00ff;">%placeholders </span>are replaced themed as well</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/drupal-notes-1-module-hook_block-hook_help-check_plain-check_url-watchdog-t-l-placeholders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Interface and Abstract Class example</title>
		<link>http://alexyz.com/php-interface-and-abstract-class-example-good-stuff/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-interface-and-abstract-class-example-good-stuff</link>
		<comments>http://alexyz.com/php-interface-and-abstract-class-example-good-stuff/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 03:05:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=459</guid>
		<description><![CDATA[abstract class animal { abstract function getowned(); private $age; protected function __construct($age) { $this-&#62;age = $age; } public function getage() { return $this-&#62;age; } } interface insurable { public function getvalue(); } class pet extends animal implements insurable { private $name; public function __construct($name,$age) { parent::__construct($age); $this-&#62;name = $name; } public function getname() { return [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">abstract</span> class animal<br />
{<br />
abstract function getowned();<br />
private $age;</p>
<p>protected function __construct($age) {<br />
$this-&gt;age = $age;<br />
}</p>
<p>public function getage()<br />
{<br />
return $this-&gt;age;<br />
}<br />
}<br />
<span style="color: #0000ff;">interface</span> insurable {<br />
public function getvalue();<br />
}</p>
<p>class pet <span style="color: #0000ff;">extends</span> animal<span style="color: #0000ff;"> implements</span> insurable {<br />
private $name;<br />
public function __construct($name,$age) {<br />
parent::__construct($age);<br />
$this-&gt;name = $name;<br />
}<br />
public function getname() {<br />
return $this-&gt;name;<br />
}<br />
public function getowned() {<br />
return (&#8220;Owner String&#8221;);<br />
}<br />
public function getvalue() {<br />
return (&#8220;Priceless&#8221;);<br />
}<br />
}</p>
<p>class house<span style="color: #0000ff;"> implements</span> insurable {<br />
public function getvalue() {<br />
return (&#8220;Rising fast&#8221;);<br />
}</p>
<p>}</p>
<p>$charlie = new pet(&#8220;Charlie&#8221;,6);<br />
$catage = $charlie -&gt; getage();<br />
$catname = $charlie -&gt; getname();<br />
print &#8220;$catname is $catage years old!&lt;br&gt;&lt;br&gt;&#8221;;</p>
<p>if ($charlie instanceof pet) print (&#8220;charlie is a pet&lt;br&gt;&#8221;);<br />
if ($charlie instanceof animal) print (&#8220;charlie is an animal&lt;br&gt;&#8221;);<br />
if ($charlie instanceof house) print (&#8220;charlie is a house&lt;br&gt;&#8221;);</p>
<p>if ($charlie instanceof insurable) print (&#8220;charlie is insurable&lt;br&gt;&#8221;);<br />
reference: <a href="http://www.wellho.net/resources/ex.php4?item=h108/animal3.php">http://www.wellho.net/resources/ex.php4?item=h108/animal3.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-interface-and-abstract-class-example-good-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple PHP namespace example</title>
		<link>http://alexyz.com/simple-php-namespace-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=simple-php-namespace-example</link>
		<comments>http://alexyz.com/simple-php-namespace-example/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 22:22:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=454</guid>
		<description><![CDATA[Foo.class.php class Foo { function Simple() { $var = &#8220;Hello&#8221;; return $var; } } namespace.php namespace Second; include(&#8216;Foo.class.php&#8217;); class Foo { function Simple() { $var = &#8220;Hello in Second Namespace&#60;br /&#62;&#8221;; return $var; } } $fooSecond = new \Second\Foo(); echo $fooSecond-&#62;Simple(); //option 1 //$fooFirst = new \Foo(); //$fooFirst-&#62;Simple(); //option 2 echo \Foo::Simple();]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">Foo.class.php</span><span style="color: #ff0000;"> </span><br />
class Foo<br />
{<br />
function Simple()<br />
{<br />
$var = &#8220;Hello&#8221;;<br />
return $var;<br />
}<br />
}</p>
<p><span style="color: #ff0000;"><span style="color: #0000ff;">namespace.php</span></span><br />
<span style="color: #ff9900;">namespace Second;</span><br />
include(&#8216;Foo.class.php&#8217;);</p>
<p>class Foo<br />
{<br />
function Simple()<br />
{<br />
$var = &#8220;Hello in Second Namespace&lt;br /&gt;&#8221;;<br />
return $var;<br />
}<br />
}</p>
<p>$fooSecond = new \Second\Foo();<br />
echo $fooSecond-&gt;Simple();<br />
<span style="color: #008000;">//option 1<br />
//$fooFirst = new \Foo();<br />
//$fooFirst-&gt;Simple();<br />
//option 2</span><br />
echo \Foo::Simple();</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/simple-php-namespace-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple PHP __autoload example</title>
		<link>http://alexyz.com/simple-php-__autoload-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=simple-php-__autoload-example</link>
		<comments>http://alexyz.com/simple-php-__autoload-example/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 21:40:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=452</guid>
		<description><![CDATA[Foo.class.php class Foo { public static $varz; public static function Simple() { self::$varz = &#8220;Hello&#8221;; return self::$varz; } } index.php (in the same directory) function __autoload($classname) { include(&#8220;$classname.class.php&#8221;); } //include &#8220;Foo.class.php&#8221;; //no longer needed! $foo = new Foo(); echo $foo-&#62;Simple();]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">Foo.class.php</span><br />
class Foo<br />
{<br />
public static $varz;<br />
public static function Simple()<br />
{<br />
self::$varz = &#8220;Hello&#8221;;<br />
return self::$varz;<br />
}<br />
}</p>
<p><span style="color: #0000ff;">index.php (in the same directory)</span><br />
function __autoload($classname) {<br />
include(&#8220;$classname.class.php&#8221;);<br />
}</p>
<p><span style="color: #008000;">//include &#8220;Foo.class.php&#8221;; //no longer needed!</span></p>
<p>$foo = new Foo();<br />
echo $foo-&gt;Simple();</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/simple-php-__autoload-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple ob_start(), flush(), ob_gzhandler, sleep(),  HEREDOC examples</title>
		<link>http://alexyz.com/simple-ob_start-flush-ob_gzhandler-examples/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=simple-ob_start-flush-ob_gzhandler-examples</link>
		<comments>http://alexyz.com/simple-ob_start-flush-ob_gzhandler-examples/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 09:11:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=448</guid>
		<description><![CDATA[//ob_start() ob_start(); print &#8220;Hello First!\n&#8221;; ob_end_flush(); ob_start(); print &#8220;Hello Second!\n&#8221;; ob_end_clean(); ob_start(); print &#8220;Hello Third!\n&#8221;; //outputs &#8220;Hello First! Hello Third!&#8221; //flush() &#60;HTML&#62; &#60;BODY&#62; &#60;DIV ID=&#8221;flushme&#8221;&#62; Hello, world! &#60;/DIV&#62; &#60; ? php flush(); sleep(2); ? &#62; &#60;SCRIPT&#62; d = document.getElementById(&#8220;flushme&#8221;); d.innerHTML = &#8220;Goodbye, Perl!&#8221;; &#60;/SCRIPT&#62; &#60; ? php flush(); sleep(2); ? &#62; &#60;SCRIPT&#62; d.innerHTML = &#8220;Goodnight, [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;">//ob_start()</span><br />
ob_start();<br />
print &#8220;Hello First!\n&#8221;;<br />
ob_end_flush();</p>
<p>ob_start();<br />
print &#8220;Hello Second!\n&#8221;;<br />
ob_end_clean();</p>
<p>ob_start();<br />
print &#8220;Hello Third!\n&#8221;;<br />
<span style="color: #ff0000;"> </span></p>
<p>//outputs &#8220;Hello First! Hello Third!&#8221;</p>
<p><span style="color: #0000ff;">//flush()</span></p>
<p>&lt;HTML&gt;<br />
&lt;BODY&gt;<br />
&lt;DIV ID=&#8221;flushme&#8221;&gt;<br />
Hello, world!<br />
&lt;/DIV&gt;<br />
<span style="color: #ff0000;">&lt; ? php</span> flush(); sleep(2); <span style="color: #ff0000;">? &gt;</span><br />
&lt;SCRIPT&gt;<br />
d = document.getElementById(&#8220;flushme&#8221;);<br />
d.innerHTML = &#8220;Goodbye, Perl!&#8221;;<br />
&lt;/SCRIPT&gt;<br />
<span style="color: #ff0000;">&lt; ? php</span> flush(); sleep(2); <span style="color: #ff0000;">? &gt;</span><br />
&lt;SCRIPT&gt;<br />
d.innerHTML = &#8220;Goodnight, New York!&#8221;;<br />
&lt;/SCRIPT&gt;<br />
&lt;/BODY&gt;<br />
&lt;/HTML&gt;</p>
<p><span style="color: #0000ff;">// compressed output</span></p>
<p><span style="color: #ff0000;">&lt; ? php</span><br />
ob_start(&#8216;ob_gzhandler&#8217;);<br />
print &#8220;My content\n&#8221;;<br />
ob_end_flush();<br />
<span style="color: #ff0000;">? &gt; </span></p>
<p><span style="color: #0000ff;">// sleep</span></p>
<p><span style="color: #ff0000;">&lt; ? php</span><br />
ob_implicit_flush(true);<br />
for($i=0;$i&lt;5;$i++)<br />
{<br />
$dis=&lt;&lt;&lt;DIS<br />
&lt;div style=&#8221;width:200px; background-color:lime;border:1px; text-align:center;text-decoration:blink;&#8221;&gt;<br />
$i<br />
&lt;/div&gt;<br />
DIS;<br />
echo $dis;</p>
<p>sleep(5);<br />
//flush();<br />
}<br />
<span style="color: #ff0000;">? &gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/simple-ob_start-flush-ob_gzhandler-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>memory jogger: Chain of responsibility, Polymorphism, Design Pattern reference, Decorator pattern, Singleton</title>
		<link>http://alexyz.com/memory-jogger-chain-of-responsibility-polymorphism-design-pattern-reference-decorator-pattern-singleton/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=memory-jogger-chain-of-responsibility-polymorphism-design-pattern-reference-decorator-pattern-singleton</link>
		<comments>http://alexyz.com/memory-jogger-chain-of-responsibility-polymorphism-design-pattern-reference-decorator-pattern-singleton/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 20:52:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=442</guid>
		<description><![CDATA[Good stuff, take a moment to refresh and review: Chain of responsibility: http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern Polymorphism: http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming JavaScript really OOP?: http://articles.techrepublic.com.com/5100-10878_11-1044656.html http://mckoss.com/jscript/object.htm JS Prototype object: http://www.javascriptkit.com/javatutors/proto4.shtml Design Patterns reference/list: http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 Decorator Pattern: http://en.wikipedia.org/wiki/Decorator_pattern Loose Coupling def: http://en.wikipedia.org/wiki/Loose_coupling Singleton Pattern: http://en.wikipedia.org/wiki/Singleton_pattern]]></description>
			<content:encoded><![CDATA[<p>Good stuff, take a moment to refresh and review:</p>
<p>Chain of responsibility:<br />
<a href="http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern">http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern</a><br />
Polymorphism:<br />
<a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming">http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming</a><br />
JavaScript really OOP?:<br />
<a href="http://articles.techrepublic.com.com/5100-10878_11-1044656.html">http://articles.techrepublic.com.com/5100-10878_11-1044656.html</a><br />
<a href="http://mckoss.com/jscript/object.htm">http://mckoss.com/jscript/object.htm</a><br />
JS Prototype object:<br />
<a href="http://www.javascriptkit.com/javatutors/proto4.shtml">http://www.javascriptkit.com/javatutors/proto4.shtml</a><br />
Design Patterns reference/list:<br />
<a href="http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29">http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29</a><br />
Decorator Pattern:<br />
<a href="http://en.wikipedia.org/wiki/Decorator_pattern">http://en.wikipedia.org/wiki/Decorator_pattern</a><br />
Loose Coupling def:<br />
<a href="http://en.wikipedia.org/wiki/Loose_coupling">http://en.wikipedia.org/wiki/Loose_coupling</a><br />
Singleton Pattern:<br />
<a href="http://en.wikipedia.org/wiki/Singleton_pattern">http://en.wikipedia.org/wiki/Singleton_pattern</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/memory-jogger-chain-of-responsibility-polymorphism-design-pattern-reference-decorator-pattern-singleton/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQl sub query example 2</title>
		<link>http://alexyz.com/mysql-sub-query-example-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-sub-query-example-2</link>
		<comments>http://alexyz.com/mysql-sub-query-example-2/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 21:09:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=440</guid>
		<description><![CDATA[SELECT q.questionId, q.question, q.questionTopic, q.questionDate, q.courseId, q.customerId, v.voted_this FROM &#8221; . $course_database_questions_table_name . &#8221; q LEFT JOIN (SELECT questionId voted_this FROM votes WHERE customerId = &#8216;&#8221; . $customer_id . &#8220;&#8216;) v ON q.questionId = v.voted_this WHERE q.courseId = &#8221; . $courseId . &#8221; ORDER BY q.questionDate DESC]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">SELECT</span><br />
q.questionId,<br />
q.question,<br />
q.questionTopic,<br />
q.questionDate,<br />
q.courseId,<br />
q.customerId,<br />
v.voted_this<br />
<span style="color: #ff0000;">FROM</span><br />
&#8221; . $course_database_questions_table_name . &#8221; <span style="color: #ff0000;">q</span><br />
<span style="color: #ff0000;">LEFT JOIN</span><br />
<span style="color: #800000;">(SELECT <span style="color: #000000;">questionId</span> <span style="color: #ff0000;">voted_this</span> FROM <span style="color: #000000;">votes</span> WHERE <span style="color: #000000;">customerId = &#8216;&#8221; . $customer_id . &#8220;&#8216;</span>) v</span><br />
<span style="color: #ff0000;">ON</span><br />
q.questionId = v.voted_this<br />
<span style="color: #ff0000;">WHERE</span><br />
q.courseId = &#8221; . $courseId . &#8221;<br />
<span style="color: #ff0000;">ORDER BY</span> q.questionDate <span style="color: #ff0000;">DESC</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-sub-query-example-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL sub query example &#8211; nice</title>
		<link>http://alexyz.com/mysql-sub-query-example-nice/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-sub-query-example-nice</link>
		<comments>http://alexyz.com/mysql-sub-query-example-nice/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 22:20:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=437</guid>
		<description><![CDATA[$cp_output = &#8220;&#8221;; if(!$get_cp_data = mysql_query(&#8221; SELECT q.*, c.*, vote_counts.Tally FROM questions q LEFT JOIN (SELECT questionId, count(1) as Tally FROM votes GROUP BY questionId ) vote_counts ON q.questionId = vote_counts.questionId LEFT JOIN customers c ON c.customerId = q.customerId WHERE q.courseId = 1 ORDER BY vote_counts.Tally desc &#8220;)){ echo mysql_error(); } while($get_cp_data_array = mysql_fetch_array($get_cp_data)){ $q_id [...]]]></description>
			<content:encoded><![CDATA[<p>$cp_output = &#8220;&#8221;;<br />
if(!$get_cp_data = mysql_query(&#8221;<br />
<span style="color: #ff0000;">SELECT<br />
q.*,<br />
c.*,<br />
vote_counts.Tally<br />
FROM<br />
questions q<br />
LEFT JOIN<br />
(SELECT<br />
questionId,<br />
count(1) as Tally<br />
FROM<br />
votes<br />
GROUP BY<br />
questionId<br />
) vote_counts<br />
ON<br />
q.questionId = vote_counts.questionId<br />
LEFT JOIN<br />
customers c<br />
ON<br />
c.customerId = q.customerId<br />
WHERE<br />
q.courseId = 1<br />
ORDER BY<br />
vote_counts.Tally desc</span><br />
&#8220;)){ echo mysql_error(); }</p>
<p>while($get_cp_data_array = mysql_fetch_array($get_cp_data)){<br />
$q_id = $get_cp_data_array['questionId'];</p>
<p>$q_fname = $get_cp_data_array['customerFName'];<br />
$q_lname = $get_cp_data_array['customerLName'];<br />
$q_email = $get_cp_data_array['customerEmail'];</p>
<p>$q_topic = $get_cp_data_array['questionTopic'];<br />
$q_question = $get_cp_data_array['question'];<br />
$q_date = $get_cp_data_array['questionDate'];<br />
//$q_count = $get_cp_data_array['votecount'];<br />
$q_customer = $get_cp_data_array['customerId'];</p>
<p>if($q_topic == &#8220;&#8221;){ $q_topic = &#8220;&#8211;&#8221;; }<br />
if($q_fname != &#8220;&#8221; || $q_lname != &#8220;&#8221;){<br />
$from = &#8216;&lt;strong&gt;&#8217; . $q_fname . &#8216; &#8216; . $q_lname . &#8216;&lt;/strong&gt; &#8211; &#8216;;<br />
}</p>
<p># Parse the question text.<br />
$old = array(&#8220;\n&#8221;);<br />
$new   = array(&#8220;&lt;br/&gt;&#8221;);<br />
$q_question = str_replace($old, $new, $q_question);</p>
<p># Output the question.<br />
$cp_output = $cp_output . &#8216;<br />
&lt;div&gt;&#8217; . $q_id . &#8216;&lt;/div&gt;<br />
&lt;div&gt;<br />
&lt;div&gt;&lt;strong&gt;&#8217; . $q_topic . &#8216;&lt;/strong&gt;&lt;/div&gt;<br />
&lt;div&gt;&#8217; . $q_question . &#8216;&lt;/div&gt;<br />
&lt;div&gt;&lt;strong&gt;Submitted&lt;/strong&gt; &#8216; . $q_date . &#8216; by &#8216; . $from . &#8216;&lt;a href=&#8221;mailto:&#8217; . $q_email . &#8216;&#8221;&gt;&#8217; . $q_email . &#8216;&lt;/a&gt;&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;div&gt;&lt;/div&gt;<br />
&#8216;;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-sub-query-example-nice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>clean &amp; simple check your $_SERVER var</title>
		<link>http://alexyz.com/clean-simple-check-your-_server-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=clean-simple-check-your-_server-var</link>
		<comments>http://alexyz.com/clean-simple-check-your-_server-var/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 21:43:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=428</guid>
		<description><![CDATA[&#60;? echo &#8220;&#60;pre&#62;&#8221;; print_r($_SERVER); ?&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;?</p>
<p>echo &#8220;&lt;pre&gt;&#8221;;<br />
print_r($_SERVER);</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/clean-simple-check-your-_server-var/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress PHP custom theme functions.php hook</title>
		<link>http://alexyz.com/wordpress-php-custom-theme-functions-php-hook/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-php-custom-theme-functions-php-hook</link>
		<comments>http://alexyz.com/wordpress-php-custom-theme-functions-php-hook/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 23:33:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=420</guid>
		<description><![CDATA[In your theme (wp-content/themes/YourNewTheme) create or find functions.php and start making whatever you need.  It&#8217;s a nice clean place to put things without hacking away at your code, dynamically inserting with JS, or whatever other measure you&#8217;ve either employed in the past, or are considering now&#8230; for example, &#60;?php //My own footer hook function my_footer() [...]]]></description>
			<content:encoded><![CDATA[<p>In your theme (wp-content/themes/YourNewTheme) create or find functions.php</p>
<p>and start making whatever you need.  It&#8217;s a nice clean place to put things <span style="color: #ff0000;">without</span> hacking away at your code,</p>
<p>dynamically inserting with JS, or whatever other measure you&#8217;ve either employed in the past, or are considering now&#8230;</p>
<p>for example,</p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
<span style="color: #ff6600;">//My own footer hook</span><br />
function my_footer() {</p>
<p>//code to execute</p>
<p><span style="color: #ff0000;">?&gt;</span>&lt;div class=&#8221;bigText&#8221;&gt;blah blah blah&lt;/div&gt;<span style="color: #ff0000;">&lt;?</span></p>
<p><span style="color: #000000;">}</span></p>
<p><span style="color: #ff0000;">?&gt;</span></p>
<p><span style="color: #000000;">then, wherever you like, call your new function, example, replace all <span style="color: #ff0000;">&lt;? wp_footer(); ?&gt;</span> calls with, you guested it, </span><span style="color: #ff0000;">&lt;? my_footer(); ?&gt;<br />
</span></p>
<p>thanks to: <a href="http://www.raymondselda.com/understanding-action-hooks-in-wordpress/">http://www.raymondselda.com/understanding-action-hooks-in-wordpress/</a></p>
<p>Don&#8217;t forget to include the following in your new custom theme functions.php file if you want the dynamic custom drag widget sidebar!:</p>
<p><span style="color: #ff0000;">if ( function_exists(&#8216;register_sidebar&#8217;) )<br />
register_sidebar();</span></p>
<p>reference: <a href="http://codex.wordpress.org/Widgetizing_Themes">http://codex.wordpress.org/Widgetizing_Themes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-php-custom-theme-functions-php-hook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;&amp;&#8221; preceeding variable &amp; Passing function parameters by reference variable PHP</title>
		<link>http://alexyz.com/preceeding-variable-passing-function-parameters-by-reference-variable-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=preceeding-variable-passing-function-parameters-by-reference-variable-php</link>
		<comments>http://alexyz.com/preceeding-variable-passing-function-parameters-by-reference-variable-php/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 06:22:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=416</guid>
		<description><![CDATA[&#38; preceeds variable $original = &#8220;foo&#8221;; $ref = &#38;$original; echo $ref; \\Prints &#8220;foo&#8221; // now we change the value of $original $original = &#8220;bar&#8221;; // and then print the value of the referring variable echo $ref; \\Now prints the new value: &#8220;bar&#8221; source: http://www.whypad.com/posts/php-what-is-the-ampersand-preceding-variables/193/ reference variable (&#38;variable) &#60;?php function add_some_extra(&#38;$string) { $string .= 'and something extra.'; } $str = 'This is a string, '; add_some_extra($str); echo $str;    // outputs 'This is a string, and something extra.' [...]]]></description>
			<content:encoded><![CDATA[<p><strong>&amp; preceeds variable</strong></p>
<p>$original = &#8220;foo&#8221;;<br />
$ref = &amp;$original;<br />
echo $ref;  \\Prints &#8220;foo&#8221;<br />
// now we change the value of $original<br />
$original = &#8220;bar&#8221;;<br />
// and then print the value of the referring variable<br />
echo $ref;  \\Now prints the new value: &#8220;bar&#8221;<br />
source: <a href="http://www.whypad.com/posts/php-what-is-the-ampersand-preceding-variables/193/">http://www.whypad.com/posts/php-what-is-the-ampersand-preceding-variables/193/</a></p>
<p><strong>reference variable (&amp;variable)</strong></p>
<div>
<div>
<p><code> <span style="color: #ff0000;">&lt;?php<br />
function add_some_extra(&amp;$string)<br />
{<br />
$string .= 'and something extra.';<br />
}<br />
$str = 'This is a string, ';<br />
add_some_extra($str);<br />
echo $str;    // outputs 'This is a string, and something extra.'<br />
?&gt; </span></code></p>
</div>
</div>
<p><span style="color: #000000;">Basically, the argument is treated, referenced by the outside variable, as global<br />
Without the &amp;, it would output &#8216;This is a string&#8217;<br />
</span>source: <a href="http://php.net/manual/en/functions.arguments.php">http://php.net/manual/en/functions.arguments.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/preceeding-variable-passing-function-parameters-by-reference-variable-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postincrement Preincrement Postdecrement Predecrement PHP careful! ++ &#8211;</title>
		<link>http://alexyz.com/postincrement-preincrement-postdecrement-predecrement-php-careful/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postincrement-preincrement-postdecrement-predecrement-php-careful</link>
		<comments>http://alexyz.com/postincrement-preincrement-postdecrement-predecrement-php-careful/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 06:07:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=412</guid>
		<description><![CDATA[&#60;?php echo "&#60;h3&#62;Postincrement&#60;/h3&#62;"; $a = 5; echo "Should be 5: " . $a++ . "&#60;br /&#62;\n"; echo "Should be 6: " . $a . "&#60;br /&#62;\n"; echo "&#60;h3&#62;Preincrement&#60;/h3&#62;"; $a = 5; echo "Should be 6: " . ++$a . "&#60;br /&#62;\n"; echo "Should be 6: " . $a . "&#60;br /&#62;\n"; echo "&#60;h3&#62;Postdecrement&#60;/h3&#62;"; $a = 5; echo "Should be 5: " . $a-- . "&#60;br /&#62;\n"; echo "Should be 4: " . $a . "&#60;br /&#62;\n"; echo "&#60;h3&#62;Predecrement&#60;/h3&#62;"; $a = 5; echo "Should be 4: " . --$a . "&#60;br /&#62;\n"; echo "Should be 4: " . $a . "&#60;br /&#62;\n"; ?&#62; source: http://php.net/manual/en/language.operators.increment.php]]></description>
			<content:encoded><![CDATA[<div>
<div>
<div><code> &lt;?php<br />
echo "&lt;h3&gt;Postincrement&lt;/h3&gt;";<br />
$a = 5;<br />
echo "Should be 5: " . $a++ . "&lt;br /&gt;\n";<br />
echo "Should be 6: " . $a . "&lt;br /&gt;\n";</p>
<p>echo "&lt;h3&gt;Preincrement&lt;/h3&gt;";<br />
$a = 5;<br />
echo "Should be 6: " . ++$a . "&lt;br /&gt;\n";<br />
echo "Should be 6: " . $a . "&lt;br /&gt;\n";</p>
<p>echo "&lt;h3&gt;Postdecrement&lt;/h3&gt;";<br />
$a = 5;<br />
echo "Should be 5: " . $a-- . "&lt;br /&gt;\n";<br />
echo "Should be 4: " . $a . "&lt;br /&gt;\n";</p>
<p>echo "&lt;h3&gt;Predecrement&lt;/h3&gt;";<br />
$a = 5;<br />
echo "Should be 4: " . --$a . "&lt;br /&gt;\n";<br />
echo "Should be 4: " . $a . "&lt;br /&gt;\n";<br />
?&gt; </code></div>
</div>
<div></div>
<div>source: <a href="http://php.net/manual/en/language.operators.increment.php">http://php.net/manual/en/language.operators.increment.php</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/postincrement-preincrement-postdecrement-predecrement-php-careful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I always like to have a nice simple AJAX example on hand, you never know&#8230;</title>
		<link>http://alexyz.com/i-always-like-to-have-a-nice-simple-ajax-example-on-hand-you-never-know/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=i-always-like-to-have-a-nice-simple-ajax-example-on-hand-you-never-know</link>
		<comments>http://alexyz.com/i-always-like-to-have-a-nice-simple-ajax-example-on-hand-you-never-know/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 04:52:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=409</guid>
		<description><![CDATA[reference: http://w3schools.com/php/php_ajax_php.asp HTML: &#60;html&#62; &#60;head&#62; &#60;script type=&#8221;text/javascript&#8221;&#62; function showHint(str) { if (str.length==0) { document.getElementById(&#8220;txtHint&#8221;).innerHTML=&#8221;"; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &#38;&#38; xmlhttp.status==200) { document.getElementById(&#8220;txtHint&#8221;).innerHTML=xmlhttp.responseText; } } xmlhttp.open(&#8220;GET&#8221;,&#8221;gethint.php?q=&#8221;+str,true); xmlhttp.send(); } &#60;/script&#62; &#60;/head &#60;body&#62; &#60;p&#62;&#60;b&#62;Start [...]]]></description>
			<content:encoded><![CDATA[<p><strong>reference:</strong></p>
<p><a href="http://w3schools.com/php/php_ajax_php.asp">http://w3schools.com/php/php_ajax_php.asp</a></p>
<p><strong>HTML:</strong></p>
<p>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
function showHint(str)<br />
{<br />
if (str.length==0)<br />
{<br />
document.getElementById(&#8220;txtHint&#8221;).innerHTML=&#8221;";<br />
return;<br />
}<br />
if (window.XMLHttpRequest)<br />
{// code for IE7+, Firefox, Chrome, Opera, Safari<br />
xmlhttp=new XMLHttpRequest();<br />
}<br />
else<br />
{// code for IE6, IE5<br />
xmlhttp=new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />
}<br />
xmlhttp.onreadystatechange=function()<br />
{<br />
if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)<br />
{<br />
document.getElementById(&#8220;txtHint&#8221;).innerHTML=xmlhttp.responseText;<br />
}<br />
}<br />
xmlhttp.open(&#8220;GET&#8221;,&#8221;gethint.php?q=&#8221;+str,true);<br />
xmlhttp.send();<br />
}<br />
&lt;/script&gt;<br />
&lt;/head<br />
&lt;body&gt;</p>
<p>&lt;p&gt;&lt;b&gt;Start typing a name in the input field below:&lt;/b&gt;&lt;/p&gt;<br />
&lt;form&gt;<br />
First name: &lt;input type=&#8221;text&#8221; onkeyup=&#8221;showHint(this.value)&#8221; size=&#8221;20&#8243; /&gt;<br />
&lt;/form&gt;<br />
&lt;p&gt;Suggestions: &lt;span id=&#8221;txtHint&#8221;&gt;&lt;/span&gt;&lt;/p&gt;</p>
<p>&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p><strong>Script:</strong></p>
<p><span style="color: #ff0000;">&lt;?php<br />
// Fill up array with names<br />
$a[]=&#8221;Anna&#8221;;<br />
$a[]=&#8221;Brittany&#8221;;<br />
$a[]=&#8221;Cinderella&#8221;;<br />
$a[]=&#8221;Diana&#8221;;<br />
$a[]=&#8221;Eva&#8221;;<br />
$a[]=&#8221;Fiona&#8221;;<br />
$a[]=&#8221;Gunda&#8221;;<br />
$a[]=&#8221;Hege&#8221;;<br />
$a[]=&#8221;Inga&#8221;;<br />
$a[]=&#8221;Johanna&#8221;;<br />
$a[]=&#8221;Kitty&#8221;;<br />
$a[]=&#8221;Linda&#8221;;<br />
$a[]=&#8221;Nina&#8221;;<br />
$a[]=&#8221;Ophelia&#8221;;<br />
$a[]=&#8221;Petunia&#8221;;<br />
$a[]=&#8221;Amanda&#8221;;<br />
$a[]=&#8221;Raquel&#8221;;<br />
$a[]=&#8221;Cindy&#8221;;<br />
$a[]=&#8221;Doris&#8221;;<br />
$a[]=&#8221;Eve&#8221;;<br />
$a[]=&#8221;Evita&#8221;;<br />
$a[]=&#8221;Sunniva&#8221;;<br />
$a[]=&#8221;Tove&#8221;;<br />
$a[]=&#8221;Unni&#8221;;<br />
$a[]=&#8221;Violet&#8221;;<br />
$a[]=&#8221;Liza&#8221;;<br />
$a[]=&#8221;Elizabeth&#8221;;<br />
$a[]=&#8221;Ellen&#8221;;<br />
$a[]=&#8221;Wenche&#8221;;<br />
$a[]=&#8221;Vicky&#8221;;</p>
<p>//get the q parameter from URL<br />
$q=$_GET["q"];</p>
<p>//lookup all hints from array if length of q&gt;0<br />
if (strlen($q) &gt; 0)<br />
{<br />
$hint=&#8221;";<br />
for($i=0; $i&lt;count($a); $i++)<br />
{<br />
if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q))))<br />
{<br />
if ($hint==&#8221;")<br />
{<br />
$hint=$a[$i];<br />
}<br />
else<br />
{<br />
$hint=$hint.&#8221; , &#8220;.$a[$i];<br />
}<br />
}<br />
}<br />
}</p>
<p>// Set output to &#8220;no suggestion&#8221; if no hint were found<br />
// or to the correct values<br />
if ($hint == &#8220;&#8221;)<br />
{<br />
$response=&#8221;no suggestion&#8221;;<br />
}<br />
else<br />
{<br />
$response=$hint;<br />
}</p>
<p>//output the response<br />
echo $response;<br />
?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/i-always-like-to-have-a-nice-simple-ajax-example-on-hand-you-never-know/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Expat XML Parser refresher</title>
		<link>http://alexyz.com/php-expat-xml-parser-refresher/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-expat-xml-parser-refresher</link>
		<comments>http://alexyz.com/php-expat-xml-parser-refresher/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 04:40:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=406</guid>
		<description><![CDATA[from: http://w3schools.com/php/php_xml_parser_expat.asp example XML &#60;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&#62; &#60;note&#62; &#60;to&#62;Tove&#60;/to&#62; &#60;from&#62;Jani&#60;/from&#62; &#60;heading&#62;Reminder&#60;/heading&#62; &#60;body&#62;Don&#8217;t forget me this weekend!&#60;/body&#62; &#60;/note&#62; script to parse: &#60;?php //Initialize the XML parser $parser=xml_parser_create(); //Function to use at the start of an element function start($parser,$element_name,$element_attrs) { switch($element_name) { case &#8220;NOTE&#8221;: echo &#8220;&#8211; Note &#8211;&#60;br /&#62;&#8221;; break; case &#8220;TO&#8221;: echo &#8220;To: &#8220;; break; case [...]]]></description>
			<content:encoded><![CDATA[<p>from: <a href="http://w3schools.com/php/php_xml_parser_expat.asp">http://w3schools.com/php/php_xml_parser_expat.asp</a></p>
<p><strong>example XML</strong></p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&gt;<br />
&lt;note&gt;<br />
&lt;to&gt;Tove&lt;/to&gt;<br />
&lt;from&gt;Jani&lt;/from&gt;<br />
&lt;heading&gt;Reminder&lt;/heading&gt;<br />
&lt;body&gt;Don&#8217;t forget me this weekend!&lt;/body&gt;<br />
&lt;/note&gt;</p>
<p><strong>script to parse:</strong></p>
<p><span style="color: #ff0000;">&lt;?php<br />
//Initialize the XML parser<br />
$parser=xml_parser_create();</p>
<p>//Function to use at the start of an element</span> <span style="color: #ff0000;"><br />
function start($parser,$element_name,$element_attrs)<br />
{<br />
switch($element_name)<br />
{<br />
case &#8220;NOTE&#8221;:<br />
echo &#8220;&#8211; Note &#8211;&lt;br /&gt;&#8221;;<br />
break;<br />
case &#8220;TO&#8221;:<br />
echo &#8220;To: &#8220;;<br />
break;<br />
case &#8220;FROM&#8221;:<br />
echo &#8220;From: &#8220;;<br />
break;<br />
case &#8220;HEADING&#8221;:<br />
echo &#8220;Heading: &#8220;;<br />
break;<br />
case &#8220;BODY&#8221;:<br />
echo &#8220;Message: &#8220;;<br />
}<br />
}</p>
<p>//Function to use at the end of an element</span> <span style="color: #ff0000;"><br />
function stop($parser,$element_name)<br />
{<br />
echo &#8220;&lt;br /&gt;&#8221;;<br />
}</p>
<p>//Function to use when finding character data</span> <span style="color: #ff0000;"><br />
function char($parser,$data)<br />
{<br />
echo $data;<br />
}</p>
<p>//Specify element handler</span> <span style="color: #ff0000;"><br />
xml_set_element_handler($parser,&#8221;start&#8221;,&#8221;stop&#8221;);</p>
<p>//Specify data handler</span> <span style="color: #ff0000;"><br />
xml_set_character_data_handler($parser,&#8221;char&#8221;);</p>
<p>//Open XML file</span> <span style="color: #ff0000;"><br />
$fp=fopen(&#8220;test.xml&#8221;,&#8221;r&#8221;);</p>
<p>//Read data</span> <span style="color: #ff0000;"><br />
while ($data=fread($fp,4096))<br />
{<br />
xml_parse($parser,$data,feof($fp)) or<br />
die (sprintf(&#8220;XML Error: %s at line %d&#8221;,<br />
xml_error_string(xml_get_error_code($parser)),<br />
xml_get_current_line_number($parser)));<br />
}</p>
<p>//Free the XML parser</span> <span style="color: #ff0000;"><br />
xml_parser_free($parser);<br />
?&gt;</span></p>
<p><strong><span style="color: #000000;">output:</span></strong></p>
<p>&#8211; Note &#8211;<br />
To: Tove<br />
From: Jani<br />
Heading: Reminder<br />
Message: Don&#8217;t forget me this weekend!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-expat-xml-parser-refresher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL refresher</title>
		<link>http://alexyz.com/mysql-refresher/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-refresher</link>
		<comments>http://alexyz.com/mysql-refresher/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 04:28:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=403</guid>
		<description><![CDATA[datatypes: http://w3schools.com/sql/sql_datatypes.asp Order results by 2 columns: SELECT column_name(s) FROM table_name ORDER BY column1, column2 Simple delete: &#60;?php $con = mysql_connect(&#8220;localhost&#8221;,&#8221;peter&#8221;,&#8221;abc123&#8243;); if (!$con) { die(&#8216;Could not connect: &#8216; . mysql_error()); } mysql_select_db(&#8220;my_db&#8221;, $con); mysql_query(&#8220;DELETE FROM Persons WHERE LastName=&#8217;Griffin&#8217;&#8221;); mysql_close($con); ?&#62;]]></description>
			<content:encoded><![CDATA[<p>datatypes:</p>
<p><a href="http://w3schools.com/sql/sql_datatypes.asp">http://w3schools.com/sql/sql_datatypes.asp</a></p>
<p>Order results by 2 columns:</p>
<p><span style="color: #888888;">SELECT column_name(s)<br />
FROM table_name<br />
ORDER BY column1, column2</span></p>
<p><span style="color: #888888;"><span style="color: #000000;">Simple delete:</span></span></p>
<p><span style="color: #ff0000;">&lt;?php<br />
$con = mysql_connect(&#8220;localhost&#8221;,&#8221;peter&#8221;,&#8221;abc123&#8243;);<br />
if (!$con)<br />
{<br />
die(&#8216;Could not connect: &#8216; . mysql_error());<br />
}<br />
mysql_select_db(&#8220;my_db&#8221;, $con);<br />
mysql_query(&#8220;DELETE FROM Persons WHERE LastName=&#8217;Griffin&#8217;&#8221;);<br />
mysql_close($con);<br />
?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-refresher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP custom error handling, log and email and user messaging</title>
		<link>http://alexyz.com/php-custom-error-handling-log-and-email-and-user-messaging/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-custom-error-handling-log-and-email-and-user-messaging</link>
		<comments>http://alexyz.com/php-custom-error-handling-log-and-email-and-user-messaging/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 03:33:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=399</guid>
		<description><![CDATA[http://w3schools.com/php/php_error.asp &#60;?php //error handler function function customError($errno, $errstr) { echo &#8220;&#60;b&#62;Error:&#60;/b&#62; [$errno] $errstr&#60;br /&#62;&#8221;; echo &#8220;Webmaster has been notified&#8221;; error_log(&#8220;Error: [$errno] $errstr&#8221;,1, &#8220;someone@example.com&#8221;,&#8221;From: webmaster@example.com&#8221;); } //set error handler set_error_handler(&#8220;customError&#8221;,E_USER_WARNING); //trigger error $test=2; if ($test&#62;1) { trigger_error(&#8220;Value must be 1 or below&#8221;,E_USER_WARNING); } ?&#62;]]></description>
			<content:encoded><![CDATA[<p><a href="http://w3schools.com/php/php_error.asp">http://w3schools.com/php/php_error.asp</a></p>
<p>&lt;?php<br />
//error handler function<br />
function customError($errno, $errstr)<br />
{<br />
echo &#8220;&lt;b&gt;Error:&lt;/b&gt; [$errno] $errstr&lt;br /&gt;&#8221;;<br />
echo &#8220;Webmaster has been notified&#8221;;<br />
error_log(&#8220;Error: [$errno] $errstr&#8221;,1,<br />
&#8220;someone@example.com&#8221;,&#8221;From: webmaster@example.com&#8221;);<br />
}</p>
<p>//set error handler<br />
set_error_handler(&#8220;customError&#8221;,E_USER_WARNING);</p>
<p>//trigger error<br />
$test=2;<br />
if ($test&gt;1)<br />
{<br />
trigger_error(&#8220;Value must be 1 or below&#8221;,E_USER_WARNING);<br />
}<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-custom-error-handling-log-and-email-and-user-messaging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>open a file and read it line by line or character by character reference refresher</title>
		<link>http://alexyz.com/open-a-file-and-read-it-line-by-line-or-character-by-character-reference-refresher/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-a-file-and-read-it-line-by-line-or-character-by-character-reference-refresher</link>
		<comments>http://alexyz.com/open-a-file-and-read-it-line-by-line-or-character-by-character-reference-refresher/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 02:49:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=396</guid>
		<description><![CDATA[from http://w3schools.com/php/php_file.asp Reading a File Line by Line The fgets() function is used to read a single line from a file. Note: After a call to this function the file pointer has moved to the next line. Example The example below reads a file line by line, until the end of file is reached: &#60;?php [...]]]></description>
			<content:encoded><![CDATA[<p>from <a href="http://w3schools.com/php/php_file.asp">http://w3schools.com/php/php_file.asp</a></p>
<h2>Reading a File Line by Line</h2>
<p>The fgets() function is used to read a single line from a file.</p>
<p><strong>Note:</strong> After a call to this function the file pointer has moved to the next  line.</p>
<h3>Example</h3>
<p>The example below reads a file line by line, until the end of  file is reached:</p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>&lt;?php<br />
$file = fopen(&#8220;welcome.txt&#8221;, &#8220;r&#8221;) or exit(&#8220;Unable to open file!&#8221;);<br />
//Output a line of the file until the end is reached<br />
while(!feof($file))<br />
{<br />
echo fgets($file). &#8220;&lt;br /&gt;&#8221;;<br />
}<br />
fclose($file);<br />
?&gt;</td>
</tr>
</tbody>
</table>
<hr />
<h2>Reading a File Character by Character</h2>
<p>The fgetc() function is used to read a single character from a file.</p>
<p><strong>Note:</strong> After a call to this function the file pointer moves to the next character.</p>
<h3>Example</h3>
<p>The example below reads a file character by character, until the end of  file is reached:</p>
<p>&lt;?php<br />
$file=fopen(&#8220;welcome.txt&#8221;,&#8221;r&#8221;) or exit(&#8220;Unable to open file!&#8221;);<br />
while (!feof($file))<br />
{<br />
echo fgetc($file);<br />
}<br />
fclose($file);<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/open-a-file-and-read-it-line-by-line-or-character-by-character-reference-refresher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>date() and timestamp refresher</title>
		<link>http://alexyz.com/date-and-timestamp-refresher/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=date-and-timestamp-refresher</link>
		<comments>http://alexyz.com/date-and-timestamp-refresher/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 02:42:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=393</guid>
		<description><![CDATA[date(format,timestamp) format is required, example: date(&#8220;Y-m-d&#8221;) of course, Y, m, and d stand for Year, month, day, and they may be separated by whatever you like, so the above example returns 2010-07-27, while date(&#8220;m/d/Y&#8221;) returns 07/27/2010 now for the timestamp parameter MAKE what should be supplied for the timestamp, with mktime(hour,minute,second,month,day,year,is_dst) $tomorrow = mktime(0,0,0,date(&#8220;m&#8221;),date(&#8220;d&#8221;)+1,date(&#8220;Y&#8221;)) date(&#8220;Y/m/d&#8221;,$tomorrow) [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">date(<em>format</em>,<em>timestamp</em>)</span></p>
<p>format is required, example:</p>
<p><span style="color: #ff0000;">date(&#8220;Y-m-d&#8221;)</span></p>
<p>of course, Y, m, and d stand for Year, month, day, and they may be separated by whatever you like, so the above example returns 2010-07-27, while <span style="color: #ff0000;">date(&#8220;m/d/Y&#8221;)</span> returns 07/27/2010</p>
<p>now for the <span style="color: #ff0000;">timestamp</span> parameter</p>
<p>MAKE what should be supplied for the <span style="color: #ff0000;">timestamp</span>, with <span style="color: #ff0000;">mktime(hour,minute,second,month,day,year,is_dst)</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #ff0000;">$tomorrow = mktime(0,0,0,date(&#8220;m&#8221;),date(&#8220;d&#8221;)+1,date(&#8220;Y&#8221;))</span></span></span></p>
<p><span style="color: #ff0000;">date(&#8220;Y/m/d&#8221;,$tomorrow) <span style="color: #000000;">returns tomorrow!</span><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/date-and-timestamp-refresher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I never seem to use the &#8220;do&#8230;while&#8221; loop so here it is just to remind me&#8230;</title>
		<link>http://alexyz.com/i-never-seem-to-use-the-do-while-loop-so-here-it-is-just-to-remind-me/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=i-never-seem-to-use-the-do-while-loop-so-here-it-is-just-to-remind-me</link>
		<comments>http://alexyz.com/i-never-seem-to-use-the-do-while-loop-so-here-it-is-just-to-remind-me/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 02:36:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=391</guid>
		<description><![CDATA[example from : http://w3schools.com/php/php_looping.asp &#60;?php $i=1; do { $i++; echo &#8220;The number is &#8221; . $i . &#8220;&#60;br /&#62;&#8221;; } while ($i&#60;=5); ?&#62; Key difference, it ALWAYS executes once, and THEN evaluates]]></description>
			<content:encoded><![CDATA[<p>example from :</p>
<p><a href="http://w3schools.com/php/php_looping.asp">http://w3schools.com/php/php_looping.asp</a></p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
$i=1;<br />
do<br />
{<br />
$i++;<br />
echo &#8220;The number is &#8221; . $i . &#8220;&lt;br /&gt;&#8221;;<br />
}<br />
while ($i&lt;=5);<br />
<span style="color: #ff0000;">?&gt;</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Key difference, it ALWAYS executes once, and THEN evaluates</span><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/i-never-seem-to-use-the-do-while-loop-so-here-it-is-just-to-remind-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>variable variables PHP awesome</title>
		<link>http://alexyz.com/variable-variable-php-awesome/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=variable-variable-php-awesome</link>
		<comments>http://alexyz.com/variable-variable-php-awesome/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 23:21:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=388</guid>
		<description><![CDATA[variable variables create variables with variable names $Bar = "a"; $Foo = "Bar"; $World = "Foo"; $Hello = "World"; $a = "Hello"; $a; //Returns Hello $$a; //Returns World $$$a; //Returns Foo $$$$a; //Returns Bar $$$$$a; //Returns a $$$$$$a; //Returns Hello $$$$$$$a; //Returns World //&#8230; and so on &#8230;// From: http://www.php.net/manual/en/language.variables.variable.php]]></description>
			<content:encoded><![CDATA[<p>variable variables create variables with variable names</p>
<p><code>$Bar = "a";<br />
$Foo = "Bar";<br />
$World = "Foo";<br />
$Hello = "World";<br />
$a = "Hello";</code></p>
<p>$a; //Returns Hello<br />
$$a; //Returns World<br />
$$$a; //Returns Foo<br />
$$$$a; //Returns Bar<br />
$$$$$a; //Returns a</p>
<p>$$$$$$a; //Returns Hello<br />
$$$$$$$a; //Returns World</p>
<p>//&#8230; and so on &#8230;//</p>
<p>From:</p>
<p><a href="http://www.php.net/manual/en/language.variables.variable.php">http://www.php.net/manual/en/language.variables.variable.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/variable-variable-php-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>using a PHP variable in a MySQL IN batch query example</title>
		<link>http://alexyz.com/using-a-php-variable-in-a-mysql-query-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-a-php-variable-in-a-mysql-query-example</link>
		<comments>http://alexyz.com/using-a-php-variable-in-a-mysql-query-example/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 23:13:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=383</guid>
		<description><![CDATA[Note the &#8216;s $product_list = &#8220;&#8217;1869&#8242;, &#8217;1929&#8242;, &#8217;549&#8242;, &#8217;189&#8242;, &#8217;419&#8242;, &#8217;176&#8242;, &#8217;192&#8242;, &#8217;310&#8242;, &#8217;291&#8242;, &#8217;514&#8242;, &#8217;1643&#8242;, &#8217;1033&#8242;&#8220;; $db_name = &#8220;dbName&#8221;; //conditional platform logic to support multiple connection scenarios switch($_SERVER['HTTP_HOST']) { case &#8216;localhost&#8217;: $db_host = &#8220;localhost&#8221;; $db_username = &#8220;userName&#8221;; $db_password = &#8220;Password&#8221;; $dblink = mysql_connect ($db_host, $db_username, $db_password); mysql_select_db($db_name, $dblink); break; case &#8216;www-staging.site.com&#8217;: break; case &#8216;www.site.com&#8217;: [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #800080;">Note the &#8216;s</span></p>
<p><strong>$product_list</strong> <span style="color: #339966;">= &#8220;</span><span style="color: #ff0000;">&#8217;1869&#8242;, &#8217;1929&#8242;, &#8217;549&#8242;, &#8217;189&#8242;, &#8217;419&#8242;, &#8217;176&#8242;, &#8217;192&#8242;, &#8217;310&#8242;, &#8217;291&#8242;, &#8217;514&#8242;, &#8217;1643&#8242;, &#8217;1033&#8242;</span><span style="color: #339966;">&#8220;</span><span style="color: #339966;">;</span></p>
<p><strong>$db_name</strong> = &#8220;dbName&#8221;<span style="color: #339966;">;</span><br />
<span style="color: #993366;">//conditional platform logic to support multiple connection scenarios</span></p>
<p><span style="color: #339966;">switch(</span><span style="color: #ff0000;">$_SERVER</span>['HTTP_HOST']<span style="color: #339966;">)</span><br />
<span style="color: #339966;">{</span><br />
<span style="color: #339966;">case</span> &#8216;localhost&#8217;<span style="color: #339966;">:</span><br />
<strong>$db_host</strong> = &#8220;localhost&#8221;<span style="color: #339966;">;</span><br />
<strong>$db_username</strong> = &#8220;userName&#8221;<span style="color: #339966;">;</span><br />
<strong>$db_password</strong> = &#8220;Password&#8221;<span style="color: #339966;">;</span><br />
<strong>$dblink</strong> = <span style="color: #ff0000;">mysql_connect</span> (<strong>$db_host</strong>, <strong>$db_username</strong>, <strong>$db_password</strong>);<br />
<span style="color: #ff0000;">mysql_select_db</span>(<strong>$db_name</strong>, <strong>$dblink</strong>);<br />
<span style="color: #339966;">break;</span><br />
<span style="color: #339966;">case</span> &#8216;www-staging.site.com&#8217;<span style="color: #339966;">: break;</span><br />
<span style="color: #339966;">case</span> &#8216;www.site.com&#8217;<span style="color: #339966;">:</span><br />
<span style="color: #339966;">include(</span>&#8216;/var/www/includes/connection_script.php&#8217;<span style="color: #339966;">);</span><br />
<span style="color: #339966;">break;</span><br />
<span style="color: #339966;">}</span></p>
<p><strong>$result</strong> = <span style="color: #ff0000;">mysql_query(&#8221;<br />
SELECT<br />
product_id,<br />
product_name<br />
FROM<br />
tableNameHere<br />
WHERE<br />
product_id IN</span><span style="color: #ff0000;"> (&#8220;<span style="color: #000000;">.</span></span><strong>$product_list</strong>.<span style="color: #ff0000;">&#8220;)</span><br />
<span style="color: #ff0000;">&#8220;)</span><span style="color: #339966;">;</span><br />
<span style="color: #339966;">if (!<strong>$result</strong>) { echo &#8220;</span>Could not successfully run query ($sql) from DB:<span style="color: #339966;"> &#8220;</span> . <span style="color: #ff0000;">mysql_error</span>()<span style="color: #339966;">; exit; }</span></p>
<p><span style="color: #993366;"><br />
//let&#8217;s break out the resource so that it can be singularly requested when needed</span></p>
<p><span style="color: #339966;">while(</span><strong>$one</strong> = <span style="color: #ff0000;">mysql_fetch_assoc</span><span style="color: #339966;">(</span><strong>$result</strong><span style="color: #339966;">))</span><br />
<span style="color: #339966;">{</span><br />
<strong>$prod_id</strong> <span style="color: #339966;">=</span> <strong>$one</strong>['<span style="color: #ff0000;">product_id</span>']<span style="color: #339966;">;</span><br />
<strong>$product_name[</strong><strong>$prod_id]</strong> <span style="color: #339966;">=</span> <strong>$one</strong>['<span style="color: #ff0000;">product_name</span>']<span style="color: #339966;">;</span><br />
<span style="color: #339966;">}<br />
@</span><span style="color: #ff0000;">mysql_close</span>(<strong>$dblink</strong>)<span style="color: #339966;">;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/using-a-php-variable-in-a-mysql-query-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Session Cookie SharedObject</title>
		<link>http://alexyz.com/flash-session-cookie-sharedobject/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flash-session-cookie-sharedobject</link>
		<comments>http://alexyz.com/flash-session-cookie-sharedobject/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 18:11:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=377</guid>
		<description><![CDATA[http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/SharedObject.html http://en.wikipedia.org/wiki/Local_Shared_Object http://www.adobe.com/support/flash/action_scripts/actionscript_tutorial/actionscript_tutorial05.html to change settings: right click on any flash swf or http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html stored here: Windows XP: For Web sites: %APPDATA%\Macromedia\Flash Player\#SharedObjects\&#60;random code&#62;\&#60;domain&#62;\&#60;path &#8211; maybe°&#62;\&#60;object name&#62;.sol And Also: %APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys Windows Vista and later: For Web sites: %APPDATA%\Macromedia\Flash Player\#SharedObjects\&#60;random code&#62;\&#60;domain&#62;\&#60;path &#8211; maybe°&#62;\&#60;object name&#62;.sol And also: %APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys For AIR Applications: unknown, likely similar to the above]]></description>
			<content:encoded><![CDATA[<p><a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/SharedObject.html">http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/SharedObject.html</a></p>
<p><a href="http://en.wikipedia.org/wiki/Local_Shared_Object">http://en.wikipedia.org/wiki/Local_Shared_Object</a></p>
<p><a href="http://www.adobe.com/support/flash/action_scripts/actionscript_tutorial/actionscript_tutorial05.html">http://www.adobe.com/support/flash/action_scripts/actionscript_tutorial/actionscript_tutorial05.html</a></p>
<p><strong>to change settings:</strong></p>
<p style="padding-left: 30px;">right click on any flash swf</p>
<p style="padding-left: 30px;">or</p>
<p style="padding-left: 30px;"><a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html">http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html</a></p>
<p style="padding-left: 30px;">
<p><strong>stored here:</strong></p>
<ul>
<li><em>Windows XP:</em>
<ul>
<li>For Web sites: %APPDATA%\Macromedia\Flash  Player\#SharedObjects\&lt;random code&gt;\&lt;domain&gt;\&lt;path &#8211;  maybe°&gt;\&lt;object name&gt;.sol</li>
<li>And Also: %APPDATA%\Macromedia\Flash  Player\macromedia.com\support\flashplayer\sys</li>
</ul>
</li>
</ul>
<ul>
<li><em>Windows Vista</em> and later:
<ul>
<li>For Web sites: %APPDATA%\Macromedia\Flash  Player\#SharedObjects\&lt;random code&gt;\&lt;domain&gt;\&lt;path &#8211;  maybe°&gt;\&lt;object name&gt;.sol</li>
<li>And also: %APPDATA%\Macromedia\Flash  Player\macromedia.com\support\flashplayer\sys</li>
<li>For AIR Applications: unknown, likely similar to the above</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/flash-session-cookie-sharedobject/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP sprintf() quick example</title>
		<link>http://alexyz.com/php-sprintf-quick-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-sprintf-quick-example</link>
		<comments>http://alexyz.com/php-sprintf-quick-example/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 22:34:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=476</guid>
		<description><![CDATA[$template = &#8216;&#60;div class=&#8221;%designIt&#8221;&#62;&#60;img src=&#8221;%s&#8221; /&#62;&#60;br /&#62;%s&#60;br /&#62;by %s&#60;/div&#62;&#8217;; $designIt = &#8220;className&#8221;; $imgSrc = &#8220;http://www.imageLivesHere.com/yo.jpg&#8221;; $copyText = &#8220;What fabulous and interesting placeholder copy!&#8221;; $sourceAuthor = &#8220;Me&#8221;; $altogetherNow = sprintf ( $template, $imgSrc, $linkText, $sourceAuthor); //Result &#60;div class=&#8221;className&#8220;&#62; &#60;img src=&#8221;http://www.imageLivesHere.com/yo.jpg&#8220;/&#62; &#60;br /&#62; What fabulous and interesting placeholder copy! &#60;br /&#62; by Me &#60;/div&#62;]]></description>
			<content:encoded><![CDATA[<p><strong>$template</strong> = &#8216;&lt;div class=&#8221;%designIt&#8221;&gt;&lt;img src=&#8221;%s&#8221; /&gt;&lt;br /&gt;%s&lt;br /&gt;by %s&lt;/div&gt;&#8217;;<br />
<strong>$designIt</strong> = &#8220;className&#8221;;<br />
<strong>$imgSrc</strong> = &#8220;http://www.imageLivesHere.com/yo.jpg&#8221;;<br />
<strong>$copyText</strong> = &#8220;What fabulous and interesting placeholder copy!&#8221;;<br />
<strong>$sourceAuthor</strong> = &#8220;Me&#8221;;<br />
<span style="color: #ff0000;"><strong>$altogetherNow</strong></span> = sprintf ( <strong>$template</strong>, <strong>$imgSrc</strong>, <strong>$linkText</strong>, <span style="color: #000000;"><strong>$sourceAuthor</strong></span><span style="color: #ff0000;">)</span>;</p>
<p><span style="color: #ff00ff;">//Result</span></p>
<p>&lt;div class=&#8221;<span style="color: #ff0000;">className</span>&#8220;&gt;<br />
&lt;img src=&#8221;<span style="color: #ff0000;">http://www.imageLivesHere.com/yo.jpg</span>&#8220;/&gt;<br />
&lt;br /&gt;<br />
<span style="color: #ff0000;">What fabulous and interesting placeholder copy!</span><br />
&lt;br /&gt;<br />
by <span style="color: #ff0000;">Me</span><br />
&lt;/div&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-sprintf-quick-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Close Fancybox from within, old (1.2) and new (1.3)</title>
		<link>http://alexyz.com/close-fancybox-from-within-old-1-2-and-new-1-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=close-fancybox-from-within-old-1-2-and-new-1-3</link>
		<comments>http://alexyz.com/close-fancybox-from-within-old-1-2-and-new-1-3/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 17:48:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=488</guid>
		<description><![CDATA[In 1.2 this worked: onclick=&#8221;$(&#8220;#fancy_outer&#8221;,window.parent.document).hide(); $(&#8220;#fancy_overlay&#8221;,window.parent.document).hide();&#8221; 1.3+ this has changed to: onclick=&#8221;parent.$.fancybox.close();&#8220;]]></description>
			<content:encoded><![CDATA[<p>In 1.2 this worked:</p>
<p>onclick=&#8221;<span style="color: #ff0000;">$(&#8220;#fancy_outer&#8221;,window.parent.document).hide(); $(&#8220;#fancy_overlay&#8221;,window.parent.document).hide();</span>&#8221;</p>
<p>1.3+ this has changed to:</p>
<p>onclick=&#8221;<span style="color: #ff0000;">parent.$.fancybox.close();</span>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/close-fancybox-from-within-old-1-2-and-new-1-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery replace all img tags with certain source&#8230;</title>
		<link>http://alexyz.com/jquery-replace-all-img-tags-with-certain-source/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-replace-all-img-tags-with-certain-source</link>
		<comments>http://alexyz.com/jquery-replace-all-img-tags-with-certain-source/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 22:55:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=370</guid>
		<description><![CDATA[$(&#8216;img&#8217;).each(function(){ var t=$(this); var src1 = t.attr(&#8216;src&#8217;); var newSrc = &#8220;images/play2.png&#8221;; if(src1 == &#8220;images/play.png&#8221;) { $(this).attr(&#8216;src&#8217;, newSrc); } });]]></description>
			<content:encoded><![CDATA[<p>$(&#8216;img&#8217;).each(function(){<br />
var t=$(this);<br />
var src1 = t.attr(&#8216;src&#8217;);<br />
var newSrc = &#8220;images/play2.png&#8221;;<br />
if(src1 == &#8220;images/play.png&#8221;)<br />
{<br />
$(this).attr(&#8216;src&#8217;, newSrc);<br />
}<br />
});</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-replace-all-img-tags-with-certain-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript URL parse to load multiple versions</title>
		<link>http://alexyz.com/javascript-url-parse-to-load-multiple-versions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-url-parse-to-load-multiple-versions</link>
		<comments>http://alexyz.com/javascript-url-parse-to-load-multiple-versions/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 22:54:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=367</guid>
		<description><![CDATA[&#60;script type=&#8221;text/javascript&#8221; src=&#8221;js/jquery-1.3.2.min.js&#8221;&#62;&#60;/script&#62; &#60;script&#62; $(document).ready(function() { &#60;!&#8211; Version requested START &#8211;&#62; if (location.search != &#8220;&#8221;) { x = location.search.substr(1).split(&#8220;;&#8221;) for (var i=0; i&#60;x.length; i++) { y = x[i].split(&#8220;=&#8221;); //alert(y[0] + &#8221; &#8221; + y[1]) // Version 2 (/?version=2) if( y[1] == 2 ){ // do things } // Version 3 (/?version=3) if( y[1] == 3 [...]]]></description>
			<content:encoded><![CDATA[<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;js/jquery-1.3.2.min.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script&gt;<br />
$(document).ready(function() {</p>
<p>&lt;!&#8211; Version requested START &#8211;&gt;<br />
if (location.search != &#8220;&#8221;)<br />
{<br />
x = location.search.substr(1).split(&#8220;;&#8221;)<br />
for (var i=0; i&lt;x.length; i++)<br />
{<br />
y = x[i].split(&#8220;=&#8221;);<br />
//alert(y[0] + &#8221; &#8221; + y[1])</p>
<p>// Version 2 (/?version=2)<br />
if( y[1] == 2 ){<br />
// do things<br />
}</p>
<p>// Version 3 (/?version=3)<br />
if( y[1] == 3 ){<br />
// do things<br />
}<br />
}<br />
}<br />
&lt;!&#8211; Version requested END &#8211;&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-url-parse-to-load-multiple-versions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery .css background-image / .attr src examples</title>
		<link>http://alexyz.com/jquery-css-background-image-attr-src-examples/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-css-background-image-attr-src-examples</link>
		<comments>http://alexyz.com/jquery-css-background-image-attr-src-examples/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 22:52:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=365</guid>
		<description><![CDATA[$(&#8220;body&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg2.jpg)&#8221;); $(&#8220;#header&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-header2.png)&#8221;); $(&#8220;#browse&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-browse2.png)&#8221;); $(&#8220;#paginate-slider2&#8243;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-slide-thumbs2.jpg)&#8221;); $(&#8220;#slides&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-slides2.png)&#8221;); $(&#8220;#ST-now&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-STnow2.png)&#8221;); $(&#8220;#searchBox&#8221;).attr(&#8220;src&#8221;, &#8220;images/search-box2.jpg&#8221;); $(&#8220;#keywordsBox&#8221;).attr(&#8220;src&#8221;, &#8220;images/keywords2.jpg&#8221;); $(&#8220;#inBox&#8221;).attr(&#8220;src&#8221;, &#8220;images/products2.jpg&#8221;);]]></description>
			<content:encoded><![CDATA[<p>$(&#8220;body&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg2.jpg)&#8221;);<br />
$(&#8220;#header&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-header2.png)&#8221;);<br />
$(&#8220;#browse&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-browse2.png)&#8221;);<br />
$(&#8220;#paginate-slider2&#8243;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-slide-thumbs2.jpg)&#8221;);<br />
$(&#8220;#slides&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-slides2.png)&#8221;);<br />
$(&#8220;#ST-now&#8221;).css(&#8220;background-image&#8221;, &#8220;url(images/bg-STnow2.png)&#8221;);<br />
$(&#8220;#searchBox&#8221;).attr(&#8220;src&#8221;, &#8220;images/search-box2.jpg&#8221;);<br />
$(&#8220;#keywordsBox&#8221;).attr(&#8220;src&#8221;, &#8220;images/keywords2.jpg&#8221;);<br />
$(&#8220;#inBox&#8221;).attr(&#8220;src&#8221;, &#8220;images/products2.jpg&#8221;);</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-css-background-image-attr-src-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery add stylesheet dynamically</title>
		<link>http://alexyz.com/jquery-add-stylesheet-dynamically/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-add-stylesheet-dynamically</link>
		<comments>http://alexyz.com/jquery-add-stylesheet-dynamically/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 22:51:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=363</guid>
		<description><![CDATA[within some logic, a function, elsewhere : var link = $(&#8220;&#60;link&#62;&#8221;); link.attr({ type: &#8216;text/css&#8217;, rel: &#8216;stylesheet&#8217;, href: &#8216;css/contentslider2.css&#8217; }); $(&#8220;head&#8221;).append( link );]]></description>
			<content:encoded><![CDATA[<p>within some logic, a function, elsewhere :</p>
<p>var link = $(&#8220;&lt;link&gt;&#8221;);<br />
link.attr({<br />
type: &#8216;text/css&#8217;,<br />
rel: &#8216;stylesheet&#8217;,<br />
href: &#8216;css/contentslider2.css&#8217;<br />
});<br />
$(&#8220;head&#8221;).append( link );</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-add-stylesheet-dynamically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP multiple equal case switch syntax</title>
		<link>http://alexyz.com/php-multiple-equal-case-switch-syntax/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-multiple-equal-case-switch-syntax</link>
		<comments>http://alexyz.com/php-multiple-equal-case-switch-syntax/#comments</comments>
		<pubDate>Tue, 04 May 2010 23:01:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=349</guid>
		<description><![CDATA[switch($holder) { case &#8220;&#8221;: case &#8220;http://www.cuealex.com/digitalcatalog&#8221;: case &#8220;http://www.iealex.com/digitalcatalog/&#8221;: echo &#8220;&#60;script&#62;alert(&#8216;http referer: none&#8217;);&#60;/script&#62;&#8221;; if(isset($_SESSION['enews_refer_value'])) { echo &#8220;&#60;script&#62;alert(&#8216;but enews_refer_value WAS set, so it stays&#8217;);&#60;/script&#62;&#8221;; $enews_refer_value = $_SESSION['enews_refer_value']; } else { $enews_refer_value = &#8220;&#8221;; } break; default: echo &#8220;&#60;script&#62;alert(&#8216;set enews_refer_value session to http_referer&#8217;);&#60;/script&#62;&#8221;; $_SESSION['enews_refer_value'] = $_SERVER['HTTP_REFERER']; $enews_refer_value = $_SESSION['enews_refer_value']; break; }]]></description>
			<content:encoded><![CDATA[<p>switch($holder)<br />
{<br />
case &#8220;&#8221;:<br />
case &#8220;http://www.cuealex.com/digitalcatalog&#8221;:<br />
case &#8220;http://www.iealex.com/digitalcatalog/&#8221;:<br />
echo &#8220;&lt;script&gt;alert(&#8216;http referer: none&#8217;);&lt;/script&gt;&#8221;;<br />
if(isset($_SESSION['enews_refer_value']))<br />
{<br />
echo &#8220;&lt;script&gt;alert(&#8216;but enews_refer_value WAS set, so it stays&#8217;);&lt;/script&gt;&#8221;;<br />
$enews_refer_value = $_SESSION['enews_refer_value'];<br />
}<br />
else { $enews_refer_value = &#8220;&#8221;; }<br />
break;<br />
default:<br />
echo &#8220;&lt;script&gt;alert(&#8216;set enews_refer_value session to http_referer&#8217;);&lt;/script&gt;&#8221;;<br />
$_SESSION['enews_refer_value'] = $_SERVER['HTTP_REFERER'];<br />
$enews_refer_value = $_SESSION['enews_refer_value'];<br />
break;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-multiple-equal-case-switch-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE7 php force download FIX</title>
		<link>http://alexyz.com/ie7-php-force-download-fix/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ie7-php-force-download-fix</link>
		<comments>http://alexyz.com/ie7-php-force-download-fix/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 22:40:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=345</guid>
		<description><![CDATA[Normally, as an  accomplished programmer, you use all the headers, follow the guidelines, include what you should&#8230; but, when Microsoft won&#8217;t play by the rules, you have to fudge&#8230; IE7 rejects forced downloads (in this example I was using doing PDF, mp3, zip, and m4b files). It opens the download dialog, chooses a location, and [...]]]></description>
			<content:encoded><![CDATA[<p>Normally, as an  accomplished programmer, you use all the headers, follow the guidelines, include what you should&#8230;</p>
<p>but, when Microsoft won&#8217;t play by the rules, you have to fudge&#8230;</p>
<p>IE7 rejects forced downloads (in this example I was using doing PDF, mp3, zip, and m4b files).</p>
<p>It opens the download dialog, chooses a location, and then commences to quit having downloaded 0 bits.</p>
<p>So, instead of the dutiful example elsewhere in this blog that chooses the correct content-type, length, transer encoding and so on&#8230;</p>
<p>We just do this, seems to work, forces it somehow, sorry, I&#8217;ve no further explanation&#8230;:</p>
<p><span style="color: #ff0000;">&lt;?</span></p>
<p><span style="color: #ff0000;">$filename = $_GET['file'];<br />
// required for IE, otherwise Content-disposition is ignored<br />
if(ini_get(&#8216;zlib.output_compression&#8217;))<br />
ini_set(&#8216;zlib.output_compression&#8217;, &#8216;Off&#8217;);</span></p>
<p><span style="color: #ff0000;">$file_extension = strtolower(substr(strrchr($filename,&#8221;.&#8221;),1));<br />
if( $filename == &#8220;&#8221; )<br />
{<br />
echo &#8220;&lt;html&gt;&lt;title&gt;&lt;/title&gt;&lt;body&gt;ERROR: download file NOT SPECIFIED.&lt;/body&gt;&lt;/html&gt;&#8221;;<br />
exit;<br />
}</span></p>
<p><span style="color: #ff0000;">header(&#8220;Cache-Control: maxage=1&#8243;);<br />
header(&#8220;Content-Type: application/force-download&#8221;);<br />
header(&#8220;Content-disposition: attachment; filename=\&#8221;". $filename .&#8221;\&#8221;;&#8221; );<br />
@readfile(&#8220;$filename&#8221;) or die(&#8220;File not found.&#8221;);<br />
exit();</span></p>
<p><span style="color: #ff0000;">?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/ie7-php-force-download-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>htaccess file to restrict Godaddy</title>
		<link>http://alexyz.com/htaccess-file-to-restrict-godaddy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=htaccess-file-to-restrict-godaddy</link>
		<comments>http://alexyz.com/htaccess-file-to-restrict-godaddy/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 18:38:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Godaddy]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=341</guid>
		<description><![CDATA[I&#8217;m using this to lock a directory of assets for a client on a godaddy hosting plan: order deny,allow allow from localhost deny from all and then accessing files there from with a php file that checks their Zend logged in/file permissions etc. (search this blog for &#8220;file serve&#8221; in content to find the php [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using this to lock a directory of  assets for a client on a godaddy hosting plan:</p>
<p>order deny,allow<br />
allow from localhost<br />
deny from all</p>
<p>and then accessing files there from with a php file that checks  their Zend logged in/file permissions etc.<br />
(search this blog for &#8220;file serve&#8221; in content to find the php  script)</p>
<p>AWESOME!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/htaccess-file-to-restrict-godaddy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP htaccess file serve script</title>
		<link>http://alexyz.com/php-htaccess-file-serve-script/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-htaccess-file-serve-script</link>
		<comments>http://alexyz.com/php-htaccess-file-serve-script/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 18:34:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=339</guid>
		<description><![CDATA[search this blog for the &#8220;htaccess&#8221; file contents to put in a directory, then use this to serve up pdf files securely from said directory: file serve php script: first check Zend permissions&#8230;logged in, permissions granted, user active, expirations, etc&#8230;.. then: &#60;? $file = &#8220;path/path/&#8221; . $_GET['file']; //$file = &#8220;Broker_Admin/Materials/Course.pdf&#8221;; header(&#8216;Content-type: application/pdf&#8217;); header(&#8220;Content-Disposition: inline; filename=&#8221;.$file); [...]]]></description>
			<content:encoded><![CDATA[<p>search this blog for the &#8220;htaccess&#8221; file contents to put in a directory, then use this to serve up pdf files securely from said directory:</p>
<p>file serve php script:</p>
<p>first check Zend permissions&#8230;logged in, permissions granted, user active, expirations, etc&#8230;..<br />
then:</p>
<p>&lt;?<br />
$file = &#8220;path/path/&#8221; . $_GET['file'];<br />
//$file = &#8220;Broker_Admin/Materials/Course.pdf&#8221;;<br />
header(&#8216;Content-type: application/pdf&#8217;);<br />
header(&#8220;Content-Disposition: inline; filename=&#8221;.$file);<br />
/*header(&#8220;Content-Disposition: attachment; filename=&#8221;.$file);*/<br />
header(&#8216;Last-Modified: &#8216;.gmdate(&#8216;D, d M Y H:i:s&#8217;) . &#8216; GMT&#8217;);<br />
header(&#8216;Cache-Control: no-store, no-cache, must-revalidate&#8217;);<br />
header(&#8216;Cache-Control: pre-check=0, post-check=0, max-age=0&#8242;);<br />
header(&#8216;Pragma: anytextexeptno-cache&#8217;, true);<br />
header(&#8216;Cache-control: private&#8217;);<br />
header(&#8216;Expires: 0&#8242;);<br />
readfile($file);<br />
?&gt;</p>
<p>then from wherever I want to call it I call this script and pass in the file wanted.</p>
<p>like this:</p>
<p>&lt;a href=&#8221;file_serve.php?file=Test.pdf&#8221;&gt;Download the Test file here&lt;/a&gt;</p>
<p>File is NOT accessible directly, or via this script since it first checks visitor&#8217;s SESSIONS, ZEND Permissions, that variables passed to it are set, etc. and so on&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-htaccess-file-serve-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery bind select change to anchor window.open variable</title>
		<link>http://alexyz.com/php-file-force-download-ie7-fix-whole-file-jquery-select-change-solution/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-file-force-download-ie7-fix-whole-file-jquery-select-change-solution</link>
		<comments>http://alexyz.com/php-file-force-download-ie7-fix-whole-file-jquery-select-change-solution/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 23:50:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=335</guid>
		<description><![CDATA[add window.open() to an anchor tag&#8230; HTML: select dropdown changes the source: &#60;div class=&#8221;name&#8221;&#62; &#60;select name=&#8221;tpom&#8221; style=&#8221;float: left; width: 100px; margin-right:20px; border: 1px solid #5A3C18;&#8221; &#62; &#60;option value=&#8221;downloader.php?file=folder/file.mp3&#8243;&#62;Mp3&#60;/option&#62; &#60;option value=&#8221;downloader.php?file=folder/file.zip&#8221;&#62;Zip&#60;/option&#62; &#60;option value=&#8221;downloader.php?file=folder/file.m4b&#8221;&#62;Ipod&#60;/option&#62; &#60;/select&#62; link or button gets source from dropdown via jQuery onReady function: $(&#8220;div.name select&#8221;).bind(&#8220;change&#8221;,function(){ $(&#8216;#button_download&#8217;).attr(&#8216;href&#8217;,this.value); windowUrl = $(this).val(); //console.log(windowUrl); }); &#60;a onclick=&#8221;window.open(windowUrl,&#8217;download&#8217;);return false;&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>add window.open() to an anchor tag&#8230;</p>
<p>HTML:</p>
<p>select dropdown changes the source:</p>
<p>&lt;div class=&#8221;name&#8221;&gt;<br />
&lt;select name=&#8221;tpom&#8221; style=&#8221;float: left; width: 100px; margin-right:20px; border: 1px solid #5A3C18;&#8221; &gt;<br />
&lt;option value=&#8221;downloader.php?file=folder/file.mp3&#8243;&gt;Mp3&lt;/option&gt;<br />
&lt;option value=&#8221;downloader.php?file=folder/file.zip&#8221;&gt;Zip&lt;/option&gt;<br />
&lt;option value=&#8221;downloader.php?file=folder/file.m4b&#8221;&gt;Ipod&lt;/option&gt;<br />
&lt;/select&gt;</p>
<p>link or button gets source from dropdown via jQuery onReady function:</p>
<p>$(&#8220;div.name select&#8221;).bind(&#8220;change&#8221;,function(){<br />
$(&#8216;#button_download&#8217;).attr(&#8216;href&#8217;,this.value);<br />
windowUrl = $(this).val();<br />
//console.log(windowUrl);<br />
});</p>
<p>&lt;a onclick=&#8221;window.open(windowUrl,&#8217;download&#8217;);return false;&#8221; id=&#8221;button_download&#8221;&gt;Download&lt;/a&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-file-force-download-ie7-fix-whole-file-jquery-select-change-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>log to the console in firefox firebug javascript</title>
		<link>http://alexyz.com/log-to-the-console-in-firefox-firebug-javascript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=log-to-the-console-in-firefox-firebug-javascript</link>
		<comments>http://alexyz.com/log-to-the-console-in-firefox-firebug-javascript/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 23:46:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=336</guid>
		<description><![CDATA[console.log(windowUrl); but remove it once you&#8217;ve learned what you need to as it will break things in other browsers&#8230;]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">console.log(windowUrl);</span></p>
<p>but remove it once you&#8217;ve learned what you need to as it will break things in other browsers&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/log-to-the-console-in-firefox-firebug-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>session_start() php when to do it again!</title>
		<link>http://alexyz.com/session_start-php-when-to-do-it-again/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=session_start-php-when-to-do-it-again</link>
		<comments>http://alexyz.com/session_start-php-when-to-do-it-again/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 22:18:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=332</guid>
		<description><![CDATA[I was stuck for a bit there. I have a page that loads via AJAX, but I had to modify it to work for Google&#8217;s googlebot #! system&#8230; The googlebot logic senses that it&#8217;s googlebot, and uses PHP includes instead of the AJAX! Well the includes don&#8217;t need the session_start() again, but the AJAX loads [...]]]></description>
			<content:encoded><![CDATA[<p>I was stuck for a bit there.</p>
<p>I have a page that loads via AJAX, but I had to modify it to work for Google&#8217;s googlebot #! system&#8230;</p>
<p>The googlebot logic senses that it&#8217;s googlebot, and uses PHP includes instead of the AJAX!</p>
<p>Well the includes don&#8217;t need the session_start() again, but the AJAX loads DO!</p>
<p>So, NOT to be forgotten, session_start() will work per LOAD, hard to explain that, but you can wrap your head around it&#8230;</p>
<p>fancy!</p>
<p>BETTER SOLUTION: Sessions manager class, framework or similar&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/session_start-php-when-to-do-it-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fancy complex php force file download script</title>
		<link>http://alexyz.com/fancy-complex-php-force-file-download-script/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fancy-complex-php-force-file-download-script</link>
		<comments>http://alexyz.com/fancy-complex-php-force-file-download-script/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 22:14:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=330</guid>
		<description><![CDATA[set_time_limit(0); $file_path=&#8217;blah.pptx&#8217;; output_file($file_path, &#8216;blah.pptx&#8217;, &#8221;); function dl_file($file){ $file = &#8216;blah.pptx&#8217;; $filename = realpath($file); $file_extension = strtolower(substr(strrchr($filename,&#8221;.&#8221;),1)); if (!file_exists($filename)) { die(&#8220;NO FILE HERE&#8221;); } $ctype=&#8221;application/vnd.ms-powerpoint&#8221;; header(&#8220;Pragma: public&#8221;); header(&#8220;Expires: 0&#8243;); header(&#8220;Cache-Control: must-revalidate, post-check=0, pre-check=0&#8243;); header(&#8220;Cache-Control: private&#8221;, false); header(&#8220;Content-Type: $ctype&#8221;); header(&#8220;Content-Disposition: attachment; filename=\&#8221;$filename\&#8221;"); header(&#8220;Content-Transfer-Encoding: binary&#8221;); header(&#8220;Content-Length: &#8220;.@filesize($filename)); set_time_limit(0); @readfile($file); exit; } function output_file($file, $name, $mime_type=&#8221;) { if(!is_readable($file)) die(&#8216;File [...]]]></description>
			<content:encoded><![CDATA[<p>set_time_limit(0);<br />
$file_path=&#8217;blah.pptx&#8217;;<br />
output_file($file_path, &#8216;blah.pptx&#8217;, &#8221;);</p>
<p>function dl_file($file){</p>
<p>$file = &#8216;blah.pptx&#8217;;<br />
$filename = realpath($file);<br />
$file_extension = strtolower(substr(strrchr($filename,&#8221;.&#8221;),1));</p>
<p>if (!file_exists($filename)) { die(&#8220;NO FILE HERE&#8221;); }<br />
$ctype=&#8221;application/vnd.ms-powerpoint&#8221;;<br />
header(&#8220;Pragma: public&#8221;);<br />
header(&#8220;Expires: 0&#8243;);<br />
header(&#8220;Cache-Control: must-revalidate, post-check=0, pre-check=0&#8243;);<br />
header(&#8220;Cache-Control: private&#8221;, false);<br />
header(&#8220;Content-Type: $ctype&#8221;);<br />
header(&#8220;Content-Disposition: attachment; filename=\&#8221;$filename\&#8221;");<br />
header(&#8220;Content-Transfer-Encoding: binary&#8221;);<br />
header(&#8220;Content-Length: &#8220;.@filesize($filename));<br />
set_time_limit(0);<br />
@readfile($file);<br />
exit;<br />
}</p>
<p>function output_file($file, $name, $mime_type=&#8221;)<br />
{</p>
<p>if(!is_readable($file)) die(&#8216;File not found or inaccessible!&#8217;);</p>
<p>$size = filesize($file);<br />
$name = rawurldecode($name);</p>
<p>/* Figure out the MIME type (if not specified) */<br />
$known_mime_types=array(<br />
&#8220;pdf&#8221; =&gt; &#8220;application/pdf&#8221;,<br />
&#8220;txt&#8221; =&gt; &#8220;text/plain&#8221;,<br />
&#8220;html&#8221; =&gt; &#8220;text/html&#8221;,<br />
&#8220;htm&#8221; =&gt; &#8220;text/html&#8221;,<br />
&#8220;exe&#8221; =&gt; &#8220;application/octet-stream&#8221;,<br />
&#8220;zip&#8221; =&gt; &#8220;application/zip&#8221;,<br />
&#8220;doc&#8221; =&gt; &#8220;application/msword&#8221;,<br />
&#8220;xls&#8221; =&gt; &#8220;application/vnd.ms-excel&#8221;,<br />
&#8220;ppt&#8221; =&gt; &#8220;application/vnd.ms-powerpoint&#8221;,<br />
&#8220;gif&#8221; =&gt; &#8220;image/gif&#8221;,<br />
&#8220;png&#8221; =&gt; &#8220;image/png&#8221;,<br />
&#8220;jpeg&#8221;=&gt; &#8220;image/jpg&#8221;,<br />
&#8220;jpg&#8221; =&gt;  &#8220;image/jpg&#8221;,<br />
&#8220;php&#8221; =&gt; &#8220;text/plain&#8221;<br />
);</p>
<p>if($mime_type==&#8221;){<br />
$file_extension = strtolower(substr(strrchr($file,&#8221;.&#8221;),1));<br />
if(array_key_exists($file_extension, $known_mime_types)){<br />
$mime_type=$known_mime_types[$file_extension];<br />
} else {<br />
$mime_type=&#8221;application/force-download&#8221;;<br />
};<br />
};</p>
<p>@ob_end_clean(); //turn off output buffering to decrease cpu usage</p>
<p>// required for IE, otherwise Content-Disposition may be ignored<br />
if(ini_get(&#8216;zlib.output_compression&#8217;))<br />
ini_set(&#8216;zlib.output_compression&#8217;, &#8216;Off&#8217;);</p>
<p>header(&#8216;Content-Type: &#8216; . $mime_type);<br />
header(&#8216;Content-Disposition: attachment; filename=&#8221;&#8216;.$name.&#8217;&#8221;&#8216;);<br />
header(&#8220;Content-Transfer-Encoding: binary&#8221;);<br />
header(&#8216;Accept-Ranges: bytes&#8217;);</p>
<p>/* The three lines below basically make the<br />
download non-cacheable */<br />
header(&#8220;Cache-control: private&#8221;);<br />
header(&#8216;Pragma: private&#8217;);<br />
header(&#8220;Expires: Mon, 26 Jul 1997 05:00:00 GMT&#8221;);</p>
<p>// multipart-download and download resuming support<br />
if(isset($_SERVER['HTTP_RANGE']))<br />
{<br />
list($a, $range) = explode(&#8220;=&#8221;,$_SERVER['HTTP_RANGE'],2);<br />
list($range) = explode(&#8220;,&#8221;,$range,2);<br />
list($range, $range_end) = explode(&#8220;-&#8221;, $range);<br />
$range=intval($range);<br />
if(!$range_end) {<br />
$range_end=$size-1;<br />
} else {<br />
$range_end=intval($range_end);<br />
}</p>
<p>$new_length = $range_end-$range+1;<br />
header(&#8220;HTTP/1.1 206 Partial Content&#8221;);<br />
header(&#8220;Content-Length: $new_length&#8221;);<br />
header(&#8220;Content-Range: bytes $range-$range_end/$size&#8221;);<br />
} else {<br />
$new_length=$size;<br />
header(&#8220;Content-Length: &#8220;.$size);<br />
}</p>
<p>/* output the file itself */<br />
$chunksize = 1*(1024*1024); //you may want to change this<br />
$bytes_send = 0;<br />
if ($file = fopen($file, &#8216;r&#8217;))<br />
{<br />
if(isset($_SERVER['HTTP_RANGE']))<br />
fseek($file, $range);</p>
<p>while(!feof($file) &amp;&amp;<br />
(!connection_aborted()) &amp;&amp;<br />
($bytes_send&lt;$new_length)<br />
)<br />
{<br />
$buffer = fread($file, $chunksize);<br />
print($buffer); //echo($buffer); // is also possible<br />
flush();<br />
$bytes_send += strlen($buffer);<br />
}<br />
fclose($file);<br />
} else die(&#8216;Error &#8211; can not open file.&#8217;);</p>
<p>die();<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/fancy-complex-php-force-file-download-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>basic php force file download script</title>
		<link>http://alexyz.com/basic-php-force-file-download-script/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=basic-php-force-file-download-script</link>
		<comments>http://alexyz.com/basic-php-force-file-download-script/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 22:00:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=327</guid>
		<description><![CDATA[&#60;?php $filename = $_GET['file']; // required for IE, otherwise Content-disposition is ignored if(ini_get(&#8216;zlib.output_compression&#8217;)) ini_set(&#8216;zlib.output_compression&#8217;, &#8216;Off&#8217;); $file_extension = strtolower(substr(strrchr($filename,&#8221;.&#8221;),1)); if( $filename == &#8220;&#8221; ) { echo &#8220;&#60;html&#62;&#60;title&#62;&#60;/title&#62;&#60;body&#62;ERROR: download file NOT SPECIFIED.&#60;/body&#62;&#60;/html&#62;&#8221;; exit; } switch( $file_extension ) { case &#8220;pdf&#8221;: $ctype=&#8221;application/pdf&#8221;; break; case &#8220;txt&#8221;: $ctype=&#8221;text/plain&#8221;; break; case &#8220;html&#8221;: $ctype=&#8221;text/html&#8221;; break; case &#8220;htm&#8221;: $ctype=&#8221;text/html&#8221;; break; case &#8220;exe&#8221;: $ctype=&#8221;application/octet-stream&#8221;; [...]]]></description>
			<content:encoded><![CDATA[<p>&lt;?php<br />
$filename = $_GET['file'];<br />
// required for IE, otherwise Content-disposition is ignored<br />
if(ini_get(&#8216;zlib.output_compression&#8217;))<br />
ini_set(&#8216;zlib.output_compression&#8217;, &#8216;Off&#8217;);</p>
<p>$file_extension = strtolower(substr(strrchr($filename,&#8221;.&#8221;),1));<br />
if( $filename == &#8220;&#8221; )<br />
{<br />
echo &#8220;&lt;html&gt;&lt;title&gt;&lt;/title&gt;&lt;body&gt;ERROR: download file NOT SPECIFIED.&lt;/body&gt;&lt;/html&gt;&#8221;;<br />
exit;<br />
}<br />
switch( $file_extension )<br />
{<br />
case &#8220;pdf&#8221;: $ctype=&#8221;application/pdf&#8221;; break;<br />
case &#8220;txt&#8221;: $ctype=&#8221;text/plain&#8221;; break;<br />
case &#8220;html&#8221;: $ctype=&#8221;text/html&#8221;; break;<br />
case &#8220;htm&#8221;: $ctype=&#8221;text/html&#8221;; break;<br />
case &#8220;exe&#8221;: $ctype=&#8221;application/octet-stream&#8221;; break;<br />
case &#8220;zip&#8221;: $ctype=&#8221;application/zip&#8221;; break;<br />
case &#8220;doc&#8221;: $ctype=&#8221;application/msword&#8221;; break;<br />
case &#8220;xls&#8221;: $ctype=&#8221;application/vnd.ms-excel&#8221;; break;<br />
case &#8220;ppt&#8221;: $ctype=&#8221;application/vnd.ms-powerpoint&#8221;; break;<br />
case &#8220;gif&#8221;: $ctype=&#8221;image/gif&#8221;; break;<br />
case &#8220;png&#8221;: $ctype=&#8221;image/png&#8221;; break;<br />
case &#8220;jpeg&#8221;: $ctype=&#8221;image/jpg&#8221;; break;<br />
case &#8220;jpg&#8221;: $ctype=&#8221;image/jpg&#8221;; break;<br />
case &#8220;php&#8221;: $ctype=&#8221;text/plain&#8221;; break;<br />
default: $ctype=&#8221;application/force-download&#8221;;<br />
}<br />
header(&#8220;Pragma: public&#8221;); // required<br />
header(&#8220;Expires: 0&#8243;);<br />
header(&#8220;Cache-Control: must-revalidate, post-check=0, pre-check=0&#8243;);<br />
header(&#8220;Cache-Control: private&#8221;,false); // required for certain browsers<br />
header(&#8220;Content-Type: $ctype&#8221;);<br />
header(&#8220;Content-Disposition: attachment; filename=\&#8221;".basename($filename).&#8221;\&#8221;;&#8221; );<br />
header(&#8220;Content-Transfer-Encoding: binary&#8221;);<br />
header(&#8220;Content-Length: &#8220;.filesize($filename));<br />
set_time_limit(0);<br />
@readfile(&#8220;$filename&#8221;) or die(&#8220;File not found.&#8221;);<br />
exit();<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/basic-php-force-file-download-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>meta no archive tag</title>
		<link>http://alexyz.com/meta-no-archive-tag/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=meta-no-archive-tag</link>
		<comments>http://alexyz.com/meta-no-archive-tag/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 17:00:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=324</guid>
		<description><![CDATA[&#60;META content=&#8221;noarchive&#8221; NAME=&#8221;robots&#8221;&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;META content=&#8221;noarchive&#8221; NAME=&#8221;robots&#8221;&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/meta-no-archive-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery scrollTo id</title>
		<link>http://alexyz.com/jquery-scrollto-id/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-scrollto-id</link>
		<comments>http://alexyz.com/jquery-scrollto-id/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 01:56:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=321</guid>
		<description><![CDATA[&#60;style&#62; .pointer { cursor: pointer; } &#60;/style&#62; &#60;a class=&#8221;pointer&#8221; onclick=&#8221;$.scrollTo(&#8216;#here1&#8242;, 1000); return false;&#8221;&#62;Here&#60;/a&#62; &#60;h3 id=&#8221;here1&#8243;&#62;text&#60;/h3&#62; &#60;h3 id=&#8221;here2&#8243;&#62;text&#60;/h3&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;style&gt;</p>
<p>.pointer { cursor: pointer; }</p>
<p>&lt;/style&gt;</p>
<p>&lt;a class=&#8221;pointer&#8221; onclick=&#8221;$.scrollTo(&#8216;#here1&#8242;, 1000); return false;&#8221;&gt;Here&lt;/a&gt;</p>
<p>&lt;h3 id=&#8221;here1&#8243;&gt;text&lt;/h3&gt;</p>
<p>&lt;h3 id=&#8221;here2&#8243;&gt;text&lt;/h3&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-scrollto-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL phpMyAdmin text string find replace Query</title>
		<link>http://alexyz.com/mysql-phpmyadmin-text-string-find-replace-query/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-phpmyadmin-text-string-find-replace-query</link>
		<comments>http://alexyz.com/mysql-phpmyadmin-text-string-find-replace-query/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 23:21:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[phpMyAdmin]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=317</guid>
		<description><![CDATA[update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME,&#8217;find this string&#8217;,'replace it with this one&#8217;); example (for videodb to turn all &#8220;wanted&#8221; titles into &#8220;DVD&#8221; titles): update videodb_videodata set mediatype = replace(mediatype,’50’,&#8217;1’);]]></description>
			<content:encoded><![CDATA[<p>update TABLE_NAME set FIELD_NAME =<br />
replace(FIELD_NAME,&#8217;find this string&#8217;,'replace it with this one&#8217;);</p>
<p>example (for videodb to turn all &#8220;wanted&#8221; titles into &#8220;DVD&#8221; titles):</p>
<p>update videodb_videodata set mediatype =<br />
replace(mediatype,’50’,&#8217;1’);</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-phpmyadmin-text-string-find-replace-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Javascript CSS gray out faded disabled element fadeTo() onload .ready()</title>
		<link>http://alexyz.com/jquery-css-javascript-gray-out-faded-element/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-css-javascript-gray-out-faded-element</link>
		<comments>http://alexyz.com/jquery-css-javascript-gray-out-faded-element/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 17:15:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=315</guid>
		<description><![CDATA[Simply fade the element you&#8217;d like faded, grayed, via your .ready onload jQuery function: $(document).ready(function() { jQuery(&#8216;#top_button&#8217;).fadeTo(0, 0.5); });]]></description>
			<content:encoded><![CDATA[<p>Simply fade the element you&#8217;d like faded, grayed, via your .ready onload jQuery function:</p>
<p><span style="color: #008000;">$(document).ready(function() {</span></p>
<p><span style="color: #008000;">jQuery(&#8216;#top_button&#8217;).fadeTo(0, 0.5);</span></p>
<p><span style="color: #008000;">});</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-css-javascript-gray-out-faded-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery set tag element disabled</title>
		<link>http://alexyz.com/jquery-set-tag-element-disabled/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-set-tag-element-disabled</link>
		<comments>http://alexyz.com/jquery-set-tag-element-disabled/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 17:13:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=312</guid>
		<description><![CDATA[jQuery(&#8216;#element1&#8242;).attr(&#8216;disabled&#8217;,'disabled&#8217;);]]></description>
			<content:encoded><![CDATA[<p>jQuery(&#8216;#element1&#8242;).attr(&#8216;disabled&#8217;,'disabled&#8217;);</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-set-tag-element-disabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery setTimeout fadeOut() fadeIn() show() hide() example</title>
		<link>http://alexyz.com/jquery-settimeout-fadeout-fadein-show-hide-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-settimeout-fadeout-fadein-show-hide-example</link>
		<comments>http://alexyz.com/jquery-settimeout-fadeout-fadein-show-hide-example/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 17:06:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=310</guid>
		<description><![CDATA[This is a bit of craziness, still it works nicely to hide a element, show another, and then a bit later hide the latter, and again show the original. $(&#8216;#item1&#8242;).bind(&#8216;click&#8217;,function() { $(&#8216;#item1&#8242;).fadeOut( function(){ setTimeout( function(){ $(&#8216;#item2&#8242;).fadeIn(function() { setTimeout( function(){ $(&#8216;#item2&#8242;).fadeOut(function(){ setTimeout( function() { $(&#8216;#item1&#8242;).fadeIn(); }, 100); }); }, 2000 ); }); }, 100); }); return [...]]]></description>
			<content:encoded><![CDATA[<p>This is a bit of craziness, still it works nicely to hide a element, show another, and then a bit later hide the latter, and again show the original.</p>
<p><span style="color: #008000;">$(&#8216;#item1&#8242;).bind(&#8216;click&#8217;,function() {</span></p>
<p><span style="color: #008000;"> $(&#8216;#item1&#8242;).fadeOut( function(){</span></p>
<p><span style="color: #008000;"> setTimeout( function(){ </span></p>
<p><span style="color: #008000;">$(&#8216;#item2&#8242;).fadeIn(function() {</span></p>
<p><span style="color: #008000;">setTimeout( function(){</span></p>
<p><span style="color: #008000;"> $(&#8216;#item2&#8242;).fadeOut(function(){</span></p>
<p><span style="color: #008000;"> setTimeout( function() {</span></p>
<p><span style="color: #008000;"> $(&#8216;#item1&#8242;).fadeIn();</span></p>
<p><span style="color: #008000;"> }, 100); </span></p>
<p><span style="color: #008000;">});</span></p>
<p><span style="color: #008000;"> }, 2000 );</span></p>
<p><span style="color: #008000;"> });</span></p>
<p><span style="color: #008000;">}, 100);</span></p>
<p><span style="color: #008000;"> }); return false;</span></p>
<p><span style="color: #008000;"> });</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-settimeout-fadeout-fadein-show-hide-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML form field readonly and disable</title>
		<link>http://alexyz.com/html-form-field-readonly-and-disable/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-form-field-readonly-and-disable</link>
		<comments>http://alexyz.com/html-form-field-readonly-and-disable/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 23:26:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=308</guid>
		<description><![CDATA[&#60;input type=&#8221;text&#8221; readonly=&#8221;readonly&#8221; &#8230;. /&#62; and equally useful &#60;input type=&#8221;text&#8221; disabled=&#8217;disabled&#8217; &#8230;/&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;input type=&#8221;text&#8221; readonly=&#8221;readonly&#8221; &#8230;. /&gt;</p>
<p>and equally useful</p>
<p>&lt;input type=&#8221;text&#8221; disabled=&#8217;disabled&#8217; &#8230;/&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/html-form-field-readonly-and-disable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Platform Environments Config for PHP applications example $_SERVER[&#039;HTTP_HOST&#039;]</title>
		<link>http://alexyz.com/platform-environments-config-for-php-applications-example-_serverhttp_host/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=platform-environments-config-for-php-applications-example-_serverhttp_host</link>
		<comments>http://alexyz.com/platform-environments-config-for-php-applications-example-_serverhttp_host/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 23:06:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=306</guid>
		<description><![CDATA[You have to look at all of your different server returned variables for each platform, and simply find one that you may reference and set per platform via script similar to: // PLATFORM CONFIG if($_SERVER['HTTP_HOST'] == &#8216;localhost&#8217;) { define(&#8216;HOME&#8217;,'http://localhost/url.com/&#8217;); define(&#8216;PLATFORM_DB&#8217;,'localhost&#8217;); } elseif($_SERVER['HTTP_HOST'] == &#8216;www-staging.url.com&#8217;) { define(&#8216;HOME&#8217;,'http://www-staging.soundstrue.com/&#8217;); define(&#8216;PLATFORM_DB&#8217;,'mktgdb.url.com&#8217;); } elseif($_SERVER['HTTP_HOST'] == &#8216;www.url.com&#8217;); { define(&#8216;HOME&#8217;,'http://www.url.com/&#8217;); define(&#8216;PLATFORM_DB&#8217;,'mktgdb.url.com&#8217;); } [...]]]></description>
			<content:encoded><![CDATA[<p>You have to look at all of your different server returned variables for each platform,</p>
<p>and simply find one that you may reference and set per platform via script similar to:</p>
<p><span style="color: #ff0000;">// PLATFORM CONFIG</span></p>
<p><span style="color: #ff0000;"><br />
if($_SERVER['HTTP_HOST'] == &#8216;localhost&#8217;)<br />
{<br />
define(&#8216;HOME&#8217;,'http://localhost/url.com/&#8217;);<br />
define(&#8216;PLATFORM_DB&#8217;,'localhost&#8217;);<br />
}<br />
elseif($_SERVER['HTTP_HOST'] == &#8216;www-staging.url.com&#8217;)<br />
{<br />
define(&#8216;HOME&#8217;,'http://www-staging.soundstrue.com/&#8217;);<br />
define(&#8216;PLATFORM_DB&#8217;,'mktgdb.url.com&#8217;);<br />
}<br />
elseif($_SERVER['HTTP_HOST'] == &#8216;www.url.com&#8217;);<br />
{<br />
define(&#8216;HOME&#8217;,'http://www.url.com/&#8217;);<br />
define(&#8216;PLATFORM_DB&#8217;,'mktgdb.url.com&#8217;);<br />
}</span></p>
<p><span style="color: #000000;">Then simply access the variable when needed:</span></p>
<p><span style="color: #ff0000;">header(&#8220;Location:&#8221; . <span style="color: #000000;">HOME</span> . &#8220;event/forums/site/index.php/&#8221;);</span></p>
<p><span style="color: #ff0000;">$boarddir = <span style="color: #000000;">HOME</span> . &#8220;event/forums/dangerous/index.php/board,1.0.html&#8221;;</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">This way you can develop on your local machine, promote your app to staging, where it will still work, and finally to production, all without re-coding those pesky app variables.</span><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/platform-environments-config-for-php-applications-example-_serverhttp_host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loop through PHP $_SERVER variables / values</title>
		<link>http://alexyz.com/loop-through-php-_server-variables-values/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=loop-through-php-_server-variables-values</link>
		<comments>http://alexyz.com/loop-through-php-_server-variables-values/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 22:37:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=303</guid>
		<description><![CDATA[&#60;?PHP foreach($_SERVER as $key_name =&#62; $key_value) { print $key_name . &#8221; = &#8221; . $key_value . &#8220;&#60;br&#62;&#8221;; } ?&#62;]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">&lt;?PHP</span></p>
<p><span style="color: #ff0000;">foreach($_SERVER as $key_name  =&gt; $key_value)            {<br />
print $key_name . &#8221; = &#8221; . $key_value             . &#8220;&lt;br&gt;&#8221;;<br />
}</span></p>
<p><span style="color: #ff0000;">?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/loop-through-php-_server-variables-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP MySQL date &amp; time reference</title>
		<link>http://alexyz.com/php-mysql-date-time-reference/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-mysql-date-time-reference</link>
		<comments>http://alexyz.com/php-mysql-date-time-reference/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 22:19:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=299</guid>
		<description><![CDATA[http://www.eltcalendar.com/stuff/datemysqlphp.html thank you for this great handy reference! pasted verbatim: Format PHP MySQL Time The function is: date(format) where &#8220;format&#8221; consists of the letters given below. The functions are: date_format(string, format) time_format(string, format) where &#8220;format&#8221; consists of the letters given below.) hour, 2-digit, 12-hour (01-12) h %h hour, 2-digit, 24-hour (00-23) H %H hour, numeric, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.eltcalendar.com/stuff/datemysqlphp.html">http://www.eltcalendar.com/stuff/datemysqlphp.html</a></p>
<p>thank you for this great handy reference!</p>
<p>pasted verbatim:</p>
<table border="1">
<tbody>
<tr>
<td><strong>Format</strong></td>
<td><strong>PHP</strong></td>
<td><strong>MySQL</strong></td>
</tr>
<tr>
<td><strong>Time</strong></td>
<td>The  function is:<br />
date(format)<br />
where &#8220;format&#8221; consists of the letters  given below.</td>
<td>The functions are:<br />
date_format(string, format)<br />
time_format(string,  format)<br />
where &#8220;format&#8221; consists of the letters given below.)</td>
</tr>
<tr>
<td>hour,  2-digit, 12-hour (01-12)</td>
<td>h</td>
<td>%h</td>
</tr>
<tr>
<td>hour,  2-digit, 24-hour (00-23)</td>
<td>H</td>
<td>%H</td>
</tr>
<tr>
<td>hour,  numeric, 12-hour (1-12)</td>
<td>g</td>
<td>%l</td>
</tr>
<tr>
<td>hour,  numeric, 24-hour (0-23)</td>
<td>G</td>
<td>%k</td>
</tr>
<tr>
<td>minute,  2-digit (00-59)</td>
<td>i</td>
<td>%i</td>
</tr>
<tr>
<td>seconds, 2-digit  (00-59)</td>
<td>s</td>
<td>%S</td>
</tr>
<tr>
<td>time, 24-hour  (hh:mm:ss)</td>
<td>none, use date(&#8220;H:i:s&#8221;)</td>
<td>%T</td>
</tr>
<tr>
<td>time,  12-hour (hh:mm:ss AM/PM)</td>
<td>none, use date(&#8220;g:i:s A&#8221;)</td>
<td>%r</td>
</tr>
<tr>
<td>AM  / PM (uppercase letters)</td>
<td>A</td>
<td>%p</td>
</tr>
<tr>
<td>am /  pm (lowercase letters)</td>
<td>a</td>
<td>none</td>
</tr>
<tr>
<td><strong>Days</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td>day  name, full (Sunday)</td>
<td>l (a lowercase L)</td>
<td>%W</td>
</tr>
<tr>
<td>day  name, abbreviation (Sun)</td>
<td>D</td>
<td>%a</td>
</tr>
<tr>
<td>day as  number of week (0-6)</td>
<td>none, use a getdate() array:<br />
First do  this:<br />
$dateInfo = getdate();<br />
Your day as number of the week is  $dateInfo[wday];</td>
<td>%w</td>
</tr>
<tr>
<td>day number of the year</td>
<td>z<br />
(Note: 0-365; <em>ex: </em>January 1st is 0)</td>
<td>%j<br />
(Note:  001-366; <em>ex: </em>January 1st is 001)</td>
</tr>
<tr>
<td><strong>Dates</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td>month  name in full (January)</td>
<td>F</td>
<td>%M</td>
</tr>
<tr>
<td>month  name, abbreviated (Jan)</td>
<td>M</td>
<td>%b</td>
</tr>
<tr>
<td>month,  2-digit (01-12)</td>
<td>m</td>
<td>%m</td>
</tr>
<tr>
<td>month, no  leading 0 (1, 2, 3 &#8211; 12)</td>
<td>n</td>
<td>%c</td>
</tr>
<tr>
<td>day of  month, 2-digit (01, 02, &#8230;)</td>
<td>d</td>
<td>%d</td>
</tr>
<tr>
<td>day  of month, no leading 0 (1, 2)</td>
<td>j</td>
<td>%e</td>
</tr>
<tr>
<td>day  of month with ordinal suffix (1st, 2nd, 3rd, 4th&#8230;)</td>
<td>none. Use  jS</td>
<td>%D</td>
</tr>
<tr>
<td>ordinal suffix (st, nd, rd, th)</td>
<td>S</td>
<td>none;  use %D (above)</td>
</tr>
<tr>
<td>year, 4 digit (2001)</td>
<td>Y</td>
<td>%Y</td>
</tr>
<tr>
<td>year,  2 digit (00-99)</td>
<td>y</td>
<td>%y</td>
</tr>
<tr>
<td height="3"></td>
<td height="3"></td>
<td height="3"></td>
</tr>
<tr>
<td><strong>Examples: To  write:</strong></td>
<td><strong>Use this:</strong></td>
<td><strong>Use this:</strong></td>
</tr>
<tr>
<td>Sunday,  June 03, 2001</td>
<td>date(&#8216;l, F d, Y&#8217;)</td>
<td>date_format(<em>date</em>,  &#8216;%W, %M %d, %Y&#8217;)</td>
</tr>
<tr>
<td>Sun., Jun 3rd, 2001. 11:30 AM</td>
<td>date(&#8216;D.,  M jS, Y.g:i A&#8217;)</td>
<td>date_format(<em>datetime</em>, &#8216;%a., %b %D, %Y.  %l: %i %p&#8217;)<br />
Or if there are two columns, one <em>date</em> and one <em>time</em>,  you&#8217;d use:<br />
date_format(<em>date</em>, &#8216;%a., %b %D, %Y.&#8217;)<br />
time_format(<em>time</em>,  &#8216;%l: %i %p&#8217;)<br />
See the note below)</td>
</tr>
<tr>
<td>2001-06-03</td>
<td>date(&#8216;Y-m-d&#8217;)</td>
<td>(see  important note below; this is default for date-type columns so you  don&#8217;t have to use any special function or formatting at all.)</td>
</tr>
</tbody>
</table>
<p><strong>Important  Note:</strong></p>
<p>The choice in MySQL between date_format() and  time_format() depends on the type of column you have stored your date  in.</p>
<table border="1">
<tbody>
<tr>
<td width="237">MySQL column  type:</td>
<td width="237">Data format in the column (all parts  are required)</td>
<td width="237">Example:</td>
<td width="237">Use:</td>
</tr>
<tr>
<td width="237"><strong>date</strong></td>
<td width="237">YYYY-MM-DD</td>
<td width="237">2001-06-03</td>
<td width="237">date_format() to get date values</td>
</tr>
<tr>
<td width="237"><strong>time</strong> (see &#8220;NB&#8221; below)</td>
<td width="237">hh:mm:ss</td>
<td width="237">13:30:00</td>
<td width="237">time_format() to get  time values</td>
</tr>
<tr>
<td width="237"><strong>datetime</strong></td>
<td width="237">YYY-MM-DD hh:mm:ss</td>
<td width="237">2001-06-03  13:30:00</td>
<td width="237">date_format() to get date and/or  time values</td>
</tr>
</tbody>
</table>
<p>NB: the <strong>time</strong> type for  MySQL columns actually represents an amount of time <em>elapsed</em>;  thus, it can be negative or positive. However, it can also be used to  represent the time of day, where it represents the amount of time  elapsed since 1 second past midnight. If you forget to add :00 for  seconds (for example, using 13:30 for 1:30 p.m.), your time value will  be interpreted as the number of minutes and seconds after midnight, or  12:30 a.m. plus 30 seconds.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-mysql-date-time-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox password manager asking and asking&#8230; turn it off</title>
		<link>http://alexyz.com/firefox-password-manager-asking-and-asking-turn-it-off/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=firefox-password-manager-asking-and-asking-turn-it-off</link>
		<comments>http://alexyz.com/firefox-password-manager-asking-and-asking-turn-it-off/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 17:43:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=297</guid>
		<description><![CDATA[options menu “Security” tab uncheck “Remember passwords for sites” http://robert.accettura.com/blog/2007/05/07/disable-password-manager/]]></description>
			<content:encoded><![CDATA[<p>options menu</p>
<p>“Security” tab</p>
<p>uncheck “Remember  passwords for sites”</p>
<p><a href="http://robert.accettura.com/blog/2007/05/07/disable-password-manager/">http://robert.accettura.com/blog/2007/05/07/disable-password-manager/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/firefox-password-manager-asking-and-asking-turn-it-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Fancybox IE width issue don&#8217;t forget the doctype!</title>
		<link>http://alexyz.com/jquery-fancybox-ie-width-issue/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-fancybox-ie-width-issue</link>
		<comments>http://alexyz.com/jquery-fancybox-ie-width-issue/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 19:10:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=292</guid>
		<description><![CDATA[Required, a doctype! example: &#60;!DOCTYPE HTML PUBLIC &#8220;-//W3C//DTD HTML 4.01//EN&#8221; &#8220;http://www.w3.org/TR/html4/strict.dtd&#8221;&#62; also, it never hurts to go get the latest versions of jquery and fancybox, at the time of this post: http://code.jquery.com/jquery-1.4.2.min.js &#38; fancybox-1.3.1.js worked nicely&#8230;]]></description>
			<content:encoded><![CDATA[<p>Required, a doctype!</p>
<p>example:</p>
<p><span style="color: #800000;">&lt;!DOCTYPE HTML PUBLIC &#8220;-//W3C//DTD HTML 4.01//EN&#8221;<br />
&#8220;http://www.w3.org/TR/html4/strict.dtd&#8221;&gt;</span></p>
<p>also, it never hurts to go get the latest versions of jquery and fancybox, at the time of this post: <span style="color: #0000ff;">http://code.jquery.com/jquery-1.4.2.min.js</span> &amp; <span style="color: #800000;">fancybox-1.3.1.js</span> worked nicely&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-fancybox-ie-width-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lightwindow IE fix</title>
		<link>http://alexyz.com/lightwindow-ie-fix/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=lightwindow-ie-fix</link>
		<comments>http://alexyz.com/lightwindow-ie-fix/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 23:08:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=289</guid>
		<description><![CDATA[Replace: this.checkImage = new PeriodicalExecuter(function(i) { if (!(typeof $(&#8216;lightwindow_image_&#8217;+i).naturalWidth != &#8220;undefined&#8221; &#38;&#38; $(&#8216;lightwindow_image_&#8217;+i).naturalWidth == 0)) { this.checkImage.stop(); var imageHeight = $(&#8216;lightwindow_image_&#8217;+i).getHeight(); if (imageHeight &#62; this.resizeTo.height) { this.resizeTo.height = imageHeight; } this.resizeTo.width += $(&#8216;lightwindow_image_&#8217;+i).getWidth(); this.imageCount&#8211;; $(&#8216;lightwindow_image_&#8217;+i).setStyle({ height: &#8217;100%&#8217;, width: &#8217;100%&#8217; }); if (this.imageCount == 0) { this._processWindow(); } } }.bind(this, i), 1); With: // We have [...]]]></description>
			<content:encoded><![CDATA[<p>Replace:</p>
<p>this.checkImage<i> = new PeriodicalExecuter(function(i) {<br />
if (!(typeof $(&#8216;lightwindow_image_&#8217;+i).naturalWidth !=  &#8220;undefined&#8221; &amp;&amp; $(&#8216;lightwindow_image_&#8217;+i).naturalWidth == 0)) { </i></p>
<p><i> this.checkImage<i>.stop(); </i></i></p>
<p><i><i> var imageHeight =  $(&#8216;lightwindow_image_&#8217;+i).getHeight();<br />
if (imageHeight &gt; this.resizeTo.height) {<br />
this.resizeTo.height = imageHeight;<br />
}<br />
this.resizeTo.width += $(&#8216;lightwindow_image_&#8217;+i).getWidth();<br />
this.imageCount&#8211;; </i></i></p>
<p><i><i> $(&#8216;lightwindow_image_&#8217;+i).setStyle({<br />
height: &#8217;100%&#8217;, width: &#8217;100%&#8217;<br />
}); </i></i></p>
<p><i><i> if (this.imageCount == 0) {<br />
this._processWindow();<br />
}<br />
} </i></i></p>
<p><i><i>}.bind(this, i), 1); </i></i></p>
<p><i><i>With: </i></i></p>
<p><i><i> // We have to do this instead of .onload<br />
var ie = (document.all)?1:0;<br />
this.checkImage<i> = new PeriodicalExecuter(function(i) {<br />
if(ie){ //THE BROWSER IS IE<br />
if ( $(&#8216;lightwindow_image_&#8217;+i).complete &amp;&amp; !(typeof  $(&#8216;lightwindow_image_&#8217;+i).naturalWidth != &#8220;undefined&#8221; &amp;&amp;  $(&#8216;lightwindow_image_&#8217;+i).naturalWidth == 0)) {<br />
this.checkImage<i>.stop(); </i></i></i></i></p>
<p><i><i><i><i> var imageHeight =  $(&#8216;lightwindow_image_&#8217;+i).getHeight();<br />
if (imageHeight &gt; this.resizeTo.height) {<br />
this.resizeTo.height = imageHeight;<br />
}<br />
this.resizeTo.width +=  $(&#8216;lightwindow_image_&#8217;+i).getWidth();<br />
this.imageCount&#8211;; </i></i></i></i></p>
<p><i><i><i><i> $(&#8216;lightwindow_image_&#8217;+i).setStyle({<br />
height: &#8217;100%&#8217;, width: &#8217;100%&#8217;<br />
}); </i></i></i></i></p>
<p><i><i><i><i> if (this.imageCount  == 0) {<br />
this._processWindow();<br />
}<br />
//alert(&#8216;IE has been detected&#8217;)<br />
}<br />
}<br />
else<br />
{//NOT IE, PROBABLY FF, OPERA, OTHER<br />
//this line works for all other browsers<br />
if ($(&#8216;lightwindow_image_&#8217;+i).complete &amp;&amp; !(typeof  $(&#8216;lightwindow_image_&#8217;+i).naturalWidth != &#8220;undefined&#8221; &amp;&amp;  $(&#8216;lightwindow_image_&#8217;+i).naturalWidth == 0)) { </i></i></i></i></p>
<p><i><i><i><i> this.checkImage<i>.stop(); </i></i></i></i></i></p>
<p><i><i><i><i><i> var  imageHeight = $(&#8216;lightwindow_image_&#8217;+i).getHeight();<br />
if (imageHeight &gt; this.resizeTo.height) {<br />
this.resizeTo.height = imageHeight;<br />
}<br />
this.resizeTo.width +=  $(&#8216;lightwindow_image_&#8217;+i).getWidth();<br />
this.imageCount&#8211;; </i></i></i></i></i></p>
<p><i><i><i><i><i> $(&#8216;lightwindow_image_&#8217;+i).setStyle({<br />
height: &#8217;100%&#8217;, width: &#8217;100%&#8217;<br />
}); </i></i></i></i></i></p>
<p><i><i><i><i><i> if  (this.imageCount == 0) {<br />
this._processWindow();<br />
}<br />
}<br />
} </i></i></i></i></i></p>
<p><i><i><i><i><i>}.bind(this, i),  1); </i></i></i></i></i></p>
<p><i><i><i><i><i><b>credit:</b><br />
</i></i></i></i></i><a href="http://www.silverstripe.org/all-other-modules/show/251991?start=8" mce_href="http://www.silverstripe.org/all-other-modules/show/251991?start=8">http://www.silverstripe.org/all-other-modules/show/251991?start=8</a><br mce_bogus="1"></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/lightwindow-ie-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL phpMyAdmin Query change table names syntax</title>
		<link>http://alexyz.com/mysql-phpmyadmin-query-change-table-names-syntax/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-phpmyadmin-query-change-table-names-syntax</link>
		<comments>http://alexyz.com/mysql-phpmyadmin-query-change-table-names-syntax/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 19:30:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=285</guid>
		<description><![CDATA[RENAME TABLE database_name.table_name TO database_name.new_table_name, database_name.table2_name TO database_name.new_table2_name; NOTE the comma and the semicolon!]]></description>
			<content:encoded><![CDATA[<p><span style="color: #333300;">RENAME TABLE</span></p>
<p><span style="color: #333300;">database_name.table_name TO database_name.new_table_name,</span></p>
<p><span style="color: #333300;">database_name.table2_name TO database_name.new_table2_name;</span></p>
<p><span style="color: #008080;">NOTE the comma and the semicolon!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-phpmyadmin-query-change-table-names-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prototype script.aculo.us form simple handling</title>
		<link>http://alexyz.com/prototype-script-aculo-us-form-simple-handling/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=prototype-script-aculo-us-form-simple-handling</link>
		<comments>http://alexyz.com/prototype-script-aculo-us-form-simple-handling/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 17:38:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[script.aculo.us]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=281</guid>
		<description><![CDATA[I&#8217;ve pretty much left script.aculo.us for jQuery for the most part, but sometimes I&#8217;m still animating with it, thought it would be good to make this easily and quickly reference-able just in case: The Form: &#60;form id=&#8221;enewsform&#8221; name=&#8221;enewsform&#8221;&#62; &#60;input name=&#8221;first_name&#8221; id=&#8221;first_name&#8221; type=&#8221;text&#8221; value=&#8221;First Name&#8221;/&#62; &#60;input name=&#8221;last_name&#8221; id=&#8221;last_name&#8221; type=&#8221;text&#8221; value=&#8221;Last Name&#8221;/&#62; &#60;input name=&#8221;email&#8221; id=&#8221;email&#8221; type=&#8221;text&#8221; value=&#8221;Email&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve pretty much left script.aculo.us for jQuery for the most part, but sometimes I&#8217;m still animating with it, thought it would be good to make this easily and quickly reference-able just in case:</p>
<p><strong>The Form:</strong></p>
<p style="padding-left: 30px;"><span style="color: #800000;">&lt;form id=&#8221;enewsform&#8221; name=&#8221;enewsform&#8221;&gt;<br />
&lt;input name=&#8221;first_name&#8221; id=&#8221;first_name&#8221; type=&#8221;text&#8221; value=&#8221;First Name&#8221;/&gt;<br />
&lt;input name=&#8221;last_name&#8221; id=&#8221;last_name&#8221; type=&#8221;text&#8221; value=&#8221;Last Name&#8221;/&gt;<br />
&lt;input name=&#8221;email&#8221; id=&#8221;email&#8221; type=&#8221;text&#8221; value=&#8221;Email&#8221; onFocus=&#8221;if(this.value == &#8216;Email&#8217;) this.value = &#8221;;&#8221; onBlur=&#8221;if(this.value == &#8221;) this.value = &#8216;Email&#8217;;&#8221;/&gt;<br />
&lt;div id=&#8221;hp_email_loading&#8221; style=&#8221;font-size:11px;display:none;&#8221;&gt;Loading&#8230; please wait.&lt;/div&gt;&lt;br /&gt;<br />
&lt;span style=&#8221;font-size:11px;&#8221;&gt;Your email address will be kept strictly confidential.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;<br />
&lt;img style=&#8221;cursor:pointer;&#8221; onClick=&#8221;enewsSubscribe(); return false&#8221; onMouseOver=&#8221;this.src=&#8217;images/submit-over.gif&#8217;&#8221; onmouseout=&#8221;this.src=&#8217;images/submit.gif&#8217;&#8221; src=&#8221;images/submit.gif&#8221; alt=&#8221;Submit&#8221;&gt;<br />
&lt;/form&gt;</span></p>
<p><strong>The Javascript:</strong></p>
<p style="padding-left: 30px;"><span style="color: #008000;">function enewsSubscribe()<br />
{<br />
var email = document.getElementById(&#8216;email&#8217;).value;<br />
var first_name = document.getElementById(&#8216;first_name&#8217;).value;<br />
var last_name = document.getElementById(&#8216;last_name&#8217;).value;<br />
new Ajax.Updater(&#8216;hp_email_box&#8217;, &#8216;filter.php?email=&#8217; + email + &#8216;&amp;first_name=&#8217; + first_name + &#8216;&amp;last_name=&#8217; + last_name //);<br />
, { onCreate: show_subscribe_loader, onComplete: hide_subscribe_loader });<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">function show_subscribe_loader()<br />
{<br />
document.getElementById(&#8216;hp_email_loading&#8217;).style.display = &#8216;block&#8217;;<br />
return false;<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">function hide_subscribe_loader()<br />
{<br />
document.getElementById(&#8216;hp_email_loading&#8217;).style.display = &#8216;none&#8217;;<br />
return false;<br />
}</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/prototype-script-aculo-us-form-simple-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Googlebot make your AJAX crawlable #! simply explained</title>
		<link>http://alexyz.com/googlebot-ajax-simply-explained/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=googlebot-ajax-simply-explained</link>
		<comments>http://alexyz.com/googlebot-ajax-simply-explained/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 17:30:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=277</guid>
		<description><![CDATA[http://code.google.com/web/ajaxcrawling/ But what? Put simply, in your URLs, that are currently: http://www.site.com/index.php#page90 First, make them: http://www.site.com/index.php#!page90 Your Javascript will just see the ! (bang) as a character, it won&#8217;t care, and will continue to work just fine Googlebot though, sees the ! and changes its query to: http://www.site.com/index.php?_escaped_fragment_=page90 So your index simply needs to see [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/web/ajaxcrawling/">http://code.google.com/web/ajaxcrawling/</a></p>
<p>But what?</p>
<p>Put simply, in your URLs, that are currently:</p>
<p><span style="color: #800080;">http://www.site.com/index.php#page90</span></p>
<p>First, make them:</p>
<p><span style="color: #800080;">http://www.site.com/index.php#!page90</span></p>
<p>Your Javascript will just see the ! (bang) as a character, it won&#8217;t care, and will continue to work just fine</p>
<p>Googlebot though, sees the ! and changes its query to:</p>
<p><span style="color: #800080;">http://www.site.com/index.php?_escaped_fragment_=page90</span></p>
<p>So your index simply needs to see $_GET['_escaped_fragment_']</p>
<p>If it&#8217;s set, load page90 via PHP instead of AJAX, and there you have it,</p>
<p>now Google will link the content it found via:</p>
<p><span style="color: #800080;">http://www.site.com/index.php?_escaped_fragment_=page90</span></p>
<p>to the url:</p>
<p><span style="color: #800080;">http://www.site.com/index.php#!page90</span></p>
<p>Now alter/resubmit your Google Sitemap so that all your URLs are current (WITH the #!) and you&#8217;re set!</p>
<p>AWESOME!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/googlebot-ajax-simply-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript HTML form field onFocus onBlur</title>
		<link>http://alexyz.com/javascript-html-form-field-onfocus-onblur/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-html-form-field-onfocus-onblur</link>
		<comments>http://alexyz.com/javascript-html-form-field-onfocus-onblur/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 17:16:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=274</guid>
		<description><![CDATA[&#60;input name=&#8221;email&#8221; id=&#8221;email&#8221; type=&#8221;text&#8221; value=&#8221;Email&#8221; onFocus=&#8221;if(this.value == &#8216;Email&#8217;) this.value = &#8221;;&#8221; onBlur=&#8221;if(this.value == &#8221;) this.value = &#8216;Email&#8217;;&#8221;/&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;input name=&#8221;email&#8221; id=&#8221;email&#8221; type=&#8221;text&#8221; value=&#8221;Email&#8221; <span style="color: #ff00ff;">onFocus=&#8221;if(this.value == &#8216;Email&#8217;) this.value = &#8221;;&#8221; onBlur=&#8221;if(this.value == &#8221;) this.value = &#8216;Email&#8217;;&#8221;</span>/&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-html-form-field-onfocus-onblur/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP include() doesn&#8217;t pass variables!</title>
		<link>http://alexyz.com/php-include-doesnt-pass-variables/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-include-doesnt-pass-variables</link>
		<comments>http://alexyz.com/php-include-doesnt-pass-variables/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 08:41:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=272</guid>
		<description><![CDATA[Really wanted it to&#8230; Seemed logical enough&#8230; index.php: &#60;? include(&#8216;some_file.php?id=3&#8242;); ?&#62; some_file.php: &#60;? echo $receive_id = $_GET['id]; ?&#62; BUT ALAS, NO Alternatively, simply set the variable, and the included script may access it just as though it were the parent script&#8230;duh.]]></description>
			<content:encoded><![CDATA[<p>Really wanted it to&#8230;</p>
<p>Seemed logical enough&#8230;</p>
<p>index.php: &lt;? include(&#8216;some_file.php?id=3&#8242;); ?&gt;</p>
<p>some_file.php: &lt;? echo $receive_id = $_GET['id]; ?&gt;</p>
<p>BUT ALAS, NO</p>
<p>Alternatively, simply set the variable, and the included script may access it just as though it were the parent script&#8230;duh.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-include-doesnt-pass-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP include $_SERVER[&#039;Document_Root&#039;] include_once AJAX</title>
		<link>http://alexyz.com/php-include-_serverdocument_root-include_once-ajax/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-include-_serverdocument_root-include_once-ajax</link>
		<comments>http://alexyz.com/php-include-_serverdocument_root-include_once-ajax/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 08:31:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=268</guid>
		<description><![CDATA[It can be tricky if your include statements don&#8217;t always load from the same location in the app, an include(&#8216;that.php&#8217;) in the root index file thinks of itself as coming from the index, so anything included THEREIN will too, but then if someday down the line you want to call an evaluation script, for example, [...]]]></description>
			<content:encoded><![CDATA[<p>It can be tricky if your include statements don&#8217;t always load from the same location in the app, an include(&#8216;that.php&#8217;) in the root index file thinks of itself as coming from the index, so anything included THEREIN will too, but then if someday down the line you want to call an evaluation script, for example, and THEN the rest of the application&#8230;a bunch might break.</p>
<p>Thus, with EVERY include, it&#8217;s best to use one of the available SERVER variables, which is a longer story, but here&#8217;s an example:</p>
<p><span style="color: #ff0000;">include($_SERVER["DOCUMENT_ROOT"] . &#8220;/site/lib/logic.inc.php&#8221;);</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">The next lesson, logically following, is that this new evaluation script needs to load in the app&#8217;s functions&#8230;but it thinks the second load (which of course only happens SOME of the time via the evaluations&#8230;) is trying to redefine the functions, HENCE:</span></span></p>
<p><span style="color: #ff0000;">include_once</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Prefer it.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Finally, you&#8217;ll notice that includes are affected differently when loaded via AJAX.  For example, index.php loads in our new evaluation.php, which then loads 1.php or 2.php and so on, that is, when the app is being loaded exclusively by php in order to be crawled by Googlebot, but if it ISN&#8217;T Googlebot visiting it this time, let&#8217;s load things via AJAX!  Short and sweet, use the above mentioned $_SERVER['Document_Root'] everywhere BUT in your JS, and use full paths if possible INSIDE, as such: </span></span>http://localhost/includeLesson/pages/page1.php, <span style="color: #ff0000;"><span style="color: #000000;">or similar Server variable to sidestep this mess, and now you can recognize these pitfalls when you encounter them, or remember their solutions next time they cross your path (by which time of course you&#8217;ll have forgotten how you solved them last&#8230;)<br />
</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-include-_serverdocument_root-include_once-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 301 redirect forward</title>
		<link>http://alexyz.com/php-301-redirect-forward/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-301-redirect-forward</link>
		<comments>http://alexyz.com/php-301-redirect-forward/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 20:06:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=265</guid>
		<description><![CDATA[&#60;? header(&#8220;HTTP/1.1 301 Moved Permanently&#8221;); header(&#8216;Location: http://www.google.com&#8217;); ?&#62;]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">&lt;?</span></p>
<p><span style="color: #ff0000;">header(&#8220;HTTP/1.1 301 Moved Permanently&#8221;);<br />
header(&#8216;Location: http://www.google.com&#8217;);</span></p>
<p><span style="color: #ff0000;">?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-301-redirect-forward/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery fancybox iframe syntax</title>
		<link>http://alexyz.com/jquery-fancybox-iframe-syntax/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-fancybox-iframe-syntax</link>
		<comments>http://alexyz.com/jquery-fancybox-iframe-syntax/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 20:14:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=261</guid>
		<description><![CDATA[&#60;head&#62; &#60;script type=&#8221;text/javascript&#8221; src=&#8221;js/jquery.js&#8221;&#62;&#60;/script&#62; &#60;script type=&#8221;text/javascript&#8221; src=&#8221;js/jquery.fancybox.1.2.1.js&#8221;&#62;&#60;/script&#62; &#60;link type=&#8221;text/css&#8221; href=&#8221;css/fancybox.css&#8221; rel=&#8221;stylesheet&#8221; media=&#8221;screen&#8221; /&#62; &#60;script&#62; $(document).ready(function() { $(&#8220;a#iframe&#8221;).fancybox({ &#8216;speedIn&#8217; : 600, &#8216;speedOut&#8217; : 200, &#8216;padding&#8217; : 20, &#8216;overlayOpacity&#8217;: 0.7, &#8216;overlayColor&#8217; : &#8216;#FFF&#8217;, &#8216;titleShow&#8217; : false, }); }); &#60;/script&#62; &#60;/head&#62; &#60;body&#62; &#60;a id=&#8221;iframe&#8221; href=&#8221;The_Power_of_Meditation_Tracks.html&#8221;&#62;View Tracks &#38;raquo;&#60;/a&#62;&#60;br /&#62; &#60;/body&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;head&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;js/jquery.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;js/jquery.fancybox.1.2.1.js&#8221;&gt;&lt;/script&gt;<br />
&lt;link type=&#8221;text/css&#8221; href=&#8221;css/fancybox.css&#8221; rel=&#8221;stylesheet&#8221; media=&#8221;screen&#8221; /&gt;</p>
<p>&lt;script&gt;</p>
<p>$(document).ready(function() {<br />
$(&#8220;a#iframe&#8221;).fancybox({<br />
&#8216;speedIn&#8217; : 600,<br />
&#8216;speedOut&#8217; : 200,<br />
&#8216;padding&#8217; : 20,<br />
&#8216;overlayOpacity&#8217;: 0.7,<br />
&#8216;overlayColor&#8217; : &#8216;#FFF&#8217;,<br />
&#8216;titleShow&#8217; : false,<br />
});<br />
});</p>
<p>&lt;/script&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;a id=&#8221;iframe&#8221; href=&#8221;The_Power_of_Meditation_Tracks.html&#8221;&gt;View Tracks &amp;raquo;&lt;/a&gt;&lt;br /&gt;</p>
<p>&lt;/body&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-fancybox-iframe-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP remove price and/or decimal and zeros Trim and substr methods</title>
		<link>http://alexyz.com/php-remove-price-andor-decimal-and-zeros-trim-and-substr-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-remove-price-andor-decimal-and-zeros-trim-and-substr-methods</link>
		<comments>http://alexyz.com/php-remove-price-andor-decimal-and-zeros-trim-and-substr-methods/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 18:26:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=259</guid>
		<description><![CDATA[Trim method: &#60;? trim(trim($num, '0'), '.'); ?&#62; substr method: &#60;? $num = number_format($num, 2); if((substr($num, -1)==0) &#38;&#38; (substr($num, -2)==0)) { $num = number_format($num,0); } else { $num = $num; } ?&#62;]]></description>
			<content:encoded><![CDATA[<p><strong>Trim method:</strong></p>
<p><span style="color: #ff0000;"><code>&lt;?</code></span></p>
<p><span style="color: #ff0000;"><code>trim(trim(</code><code>$num</code><code>, </code><code>'0'</code><code>), </code><code>'.'</code><code>);</code></span></p>
<p><span style="color: #ff0000;">?&gt;</span></p>
<p><strong>substr method:</strong></p>
<p><span style="color: #ff0000;">&lt;?<br />
</span></p>
<p><span style="color: #ff0000;">$num = number_format($num, 2);</p>
<p>if((substr($num, -1)==0) &amp;&amp; (substr($num, -2)==0))</span> <span style="color: #ff0000;"><br />
{<br />
$num = number_format($num,0);<br />
}<br />
else<br />
{<br />
$num = $num;<br />
}</span></p>
<p><span style="color: #ff0000;">?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-remove-price-andor-decimal-and-zeros-trim-and-substr-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>quick note: Javascript equivalent to PHP isset variable</title>
		<link>http://alexyz.com/quick-note-javascript-equivalent-to-php-isset-variable/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quick-note-javascript-equivalent-to-php-isset-variable</link>
		<comments>http://alexyz.com/quick-note-javascript-equivalent-to-php-isset-variable/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 20:57:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=426</guid>
		<description><![CDATA[Check to see whether or not a variable has been declared if ( typeof ( $variable ) == &#8216;undefined&#8217; ) {} else {}]]></description>
			<content:encoded><![CDATA[<p>Check to see whether or not a variable has been declared</p>
<p>if ( typeof ( $variable ) == &#8216;undefined&#8217; )</p>
<p>{}<br />
else<br />
{}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/quick-note-javascript-equivalent-to-php-isset-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery change anchor tag href url via select option</title>
		<link>http://alexyz.com/jquery-change-anchor-tag-href-url/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-change-anchor-tag-href-url</link>
		<comments>http://alexyz.com/jquery-change-anchor-tag-href-url/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 16:31:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[anchor tag]]></category>
		<category><![CDATA[href]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=216</guid>
		<description><![CDATA[&#60;select name=&#8221;tpom&#8221; onchange=&#8221;$(&#8216;#tpom_download&#8217;).attr(&#8216;href&#8217;,this.value);&#8221;&#62; &#60;option value=&#8221;media/tpom.mp3&#8243;&#62;MP3&#60;/option&#62; &#60;option value=&#8221;media/tpom.zip&#8221;&#62;ZIP&#60;/option&#62; &#60;option value=&#8221;media/tpom.m4a&#8221;&#62;IPOD&#60;/option&#62; &#60;/select&#62; &#60;div style=&#8221;float:left;width:75px;margin-top:-3px;&#8221;&#62; &#60;ul name=&#8221;st_btn&#8221; style=&#8221;text-align: right; float: right;&#8221;&#62; &#60;li name=&#8221;submit&#8221;&#62; &#60;a id=&#8221;tpom_download&#8221; title=&#8221;blah&#8221; href=&#8221;media/tpom.mp3&#8243; onclick=&#8221;return false;&#8221;&#62;Download&#60;/a&#62;&#60;/li&#62; &#60;/ul&#62; &#60;/div&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;select name=&#8221;tpom&#8221; <span style="color: #008000;">onchange=&#8221;$(&#8216;#tpom_download&#8217;).attr(&#8216;href&#8217;,this.value);&#8221;</span>&gt;<br />
&lt;option value=&#8221;media/tpom.mp3&#8243;&gt;MP3&lt;/option&gt;<br />
&lt;option value=&#8221;media/tpom.zip&#8221;&gt;ZIP&lt;/option&gt;<br />
&lt;option value=&#8221;media/tpom.m4a&#8221;&gt;IPOD&lt;/option&gt;<br />
&lt;/select&gt;<br />
&lt;div style=&#8221;float:left;width:75px;margin-top:-3px;&#8221;&gt;<br />
&lt;ul name=&#8221;st_btn&#8221; style=&#8221;text-align: right; float: right;&#8221;&gt;<br />
&lt;li name=&#8221;submit&#8221;&gt; &lt;a <span style="color: #008000;">id=&#8221;tpom_download&#8221;</span> title=&#8221;blah&#8221; href=&#8221;media/tpom.mp3&#8243; onclick=&#8221;return false;&#8221;&gt;Download&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-change-anchor-tag-href-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving WordPress DB changes and/or functions.php</title>
		<link>http://alexyz.com/moving-wordpress-db-changes-andor-functions-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=moving-wordpress-db-changes-andor-functions-php</link>
		<comments>http://alexyz.com/moving-wordpress-db-changes-andor-functions-php/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 22:12:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=212</guid>
		<description><![CDATA[change DB values table: wp-options column: option_name fields: siteurl home also to note in here: blogname upload_url_path comment_moderation rss_language admin_email ALTERNATE OPTION, (db inaccessible) add a few lines to: wp-content/themes/default/functions.php lines: update_option(&#8216;siteurl&#8217;,&#8217;http://yourUrl&#8216;); update_option(&#8216;home&#8217;,&#8217;http://yourUrl/soundstrue.com/podcast&#8216;); If the second option used not to be forgotten, as it will overwrite DB every time App loads&#8230;]]></description>
			<content:encoded><![CDATA[<p>change DB values</p>
<p><strong>table:</strong><br />
wp-options</p>
<p><strong>column:</strong><br />
option_name</p>
<p><strong>fields:</strong><br />
siteurl<br />
home</p>
<p><strong>also to note in here:</strong><br />
blogname<br />
upload_url_path<br />
comment_moderation<br />
rss_language<br />
admin_email</p>
<p>ALTERNATE OPTION, (db inaccessible)<br />
add a few lines to:<br />
<strong>wp-content/themes/default/functions.php</strong></p>
<p>lines:<br />
<strong>update_option(&#8216;siteurl&#8217;,&#8217;<span style="color: #0000ff;">http://yourUrl</span>&#8216;);<br />
update_option(&#8216;home&#8217;,&#8217;<span style="color: #0000ff;">http://yourUrl/soundstrue.com/podcast</span>&#8216;);</strong></p>
<p>If the second option used not to be forgotten, as it will overwrite  DB every time App loads&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/moving-wordpress-db-changes-andor-functions-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Akismet (spam)</title>
		<link>http://alexyz.com/wordpress-akismet-services/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-akismet-services</link>
		<comments>http://alexyz.com/wordpress-akismet-services/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 23:27:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=204</guid>
		<description><![CDATA[WordPress comes with the Akismet plugin. Use it. Reference: http://akismet.com/ How: Create a dashboard.wordpress.com account  if you don&#8217;t already have one, &#38; find your API key then in your blog, activate the Akismet plugin, enter your key, reap the rewards.]]></description>
			<content:encoded><![CDATA[<p>WordPress comes with the Akismet plugin.</p>
<p>Use it.</p>
<p>Reference: <a href="http://akismet.com/">http://akismet.com/</a></p>
<p>How:</p>
<p>Create a <a href="http://dashboard.wordpress.com">dashboard.wordpress.com</a> account  if you don&#8217;t already have one, &amp; find your API key</p>
<p>then in your blog, activate the Akismet plugin, enter your key, reap the rewards.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-akismet-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This Blog proudly uses the following Widget Plugins</title>
		<link>http://alexyz.com/this-blog-proudly-uses-the-following-widget-plugins/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=this-blog-proudly-uses-the-following-widget-plugins</link>
		<comments>http://alexyz.com/this-blog-proudly-uses-the-following-widget-plugins/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 13:54:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=196</guid>
		<description><![CDATA[Google AdSense Widget http://wordpress.smullindesign.com/plugins/google-adsense-widget Google XML Sitemaps http://www.arnebrachhold.de/redir/sitemap-home/ Simple Hit Counter http://jungwirths.com/2009/03/simple-wordpress-hit-counter-plugin/ WP Simple Paypal Donation http://www.tipsandtricks-hq.com/?page_id=942 Exec PHP http://bluesome.net/post/2005/08/18/50/ Deactivate Visual Editor http://plugindve.wordpress.com/ Google Analytics for WordPress http://yoast.com/wordpress/analytics/#utm_source=wordpress&#038;utm_medium=plugin&#038;utm_campaign=google-analytics-for-wordpress]]></description>
			<content:encoded><![CDATA[<p><strong>Google AdSense Widget</strong></p>
<p><a href="http://wordpress.smullindesign.com/plugins/google-adsense-widget">http://wordpress.smullindesign.com/plugins/google-adsense-widget</a></p>
<p><strong>Google XML Sitemaps</strong></p>
<p><a href="http://www.arnebrachhold.de/redir/sitemap-home/">http://www.arnebrachhold.de/redir/sitemap-home/</a></p>
<p><strong>Simple Hit Counter</strong></p>
<p><a href="http://jungwirths.com/2009/03/simple-wordpress-hit-counter-plugin/">http://jungwirths.com/2009/03/simple-wordpress-hit-counter-plugin/</a></p>
<p><strong>WP Simple Paypal Donation</strong></p>
<p><a href="http://www.tipsandtricks-hq.com/?page_id=942">http://www.tipsandtricks-hq.com/?page_id=942</a></p>
<p><strong>Exec PHP</strong></p>
<p><a href="http://bluesome.net/post/2005/08/18/50/">http://bluesome.net/post/2005/08/18/50/</a></p>
<p><strong>Deactivate Visual Editor</strong></p>
<p><a href="http://plugindve.wordpress.com/">http://plugindve.wordpress.com/</a></p>
<p><strong>Google Analytics for WordPress</strong></p>
<p><a href="http://yoast.com/wordpress/analytics/#utm_source=wordpress&#038;utm_medium=plugin&#038;utm_campaign=google-analytics-for-wordpress">http://yoast.com/wordpress/analytics/#utm_source=wordpress&#038;utm_medium=plugin&#038;utm_campaign=google-analytics-for-wordpress</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/this-blog-proudly-uses-the-following-widget-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export Dreamweaver Sites CS4</title>
		<link>http://alexyz.com/export-dreamweaver-sites-cs4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=export-dreamweaver-sites-cs4</link>
		<comments>http://alexyz.com/export-dreamweaver-sites-cs4/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 02:10:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Dreamweaver]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=149</guid>
		<description><![CDATA[You can now multi-select sites in the site manager and export them, easy as pie. http://www.owenwebs.com/2009/07/07/export-dreamweaver-cs4-site-info/]]></description>
			<content:encoded><![CDATA[<p>You can now multi-select sites in the site manager and export them, easy as pie.</p>
<p><span style="color: #0000ff;"><a href="http://www.owenwebs.com/2009/07/07/export-dreamweaver-cs4-site-info/">http://www.owenwebs.com/2009/07/07/export-dreamweaver-cs4-site-info/</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/export-dreamweaver-sites-cs4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Runas administrator</title>
		<link>http://alexyz.com/runas-administrator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=runas-administrator</link>
		<comments>http://alexyz.com/runas-administrator/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 01:53:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=147</guid>
		<description><![CDATA[If runas isn&#8217;t in the menu when you right click on a file, add the runas option to that file type in the registry, here&#8217;s how: http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/ otherwise: can you run any other program that can edit that file with runas? example, I wanted to edit C:\xampp\phpMyAdmin\config.inc.php as admin, first run dreamweaver as admin and [...]]]></description>
			<content:encoded><![CDATA[<p>If runas isn&#8217;t in the menu when you right click on a file, add the runas option to that file type in the registry, here&#8217;s how:</p>
<p><span style="color: #0000ff;"><a href="http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/">http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/</a></span></p>
<p>otherwise:</p>
<p>can you run any other program that can edit that file with runas?</p>
<p>example, I wanted to edit C:\xampp\phpMyAdmin\config.inc.php as admin,</p>
<p>first run dreamweaver as admin and it will also be able to save as admin!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/runas-administrator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin Server config.inc.php remote database connection</title>
		<link>http://alexyz.com/phpmyadmin-server-config/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=phpmyadmin-server-config</link>
		<comments>http://alexyz.com/phpmyadmin-server-config/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 05:19:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Godaddy]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=142</guid>
		<description><![CDATA[C:\xampp\phpMyAdmin\config.inc.php add this (or similar) at the bottom: $i++; $cfg['Servers'][$i]['auth_type'] = &#8216;config&#8217;; $cfg['Servers'][$i]['user'] = &#8216;user&#8217;; $cfg['Servers'][$i]['password'] = &#8216;password&#8217;; $cfg['Servers'][$i]['host'] = &#8216;your_host&#8217;; $cfg['Servers'][$i]['verbose'] = &#8216;Description to appear in phpMyAdmin&#8217;; //end params/reference: http://wiki.phpmyadmin.net/pma/Config And then control remote MySQL databases in your localhost/phpmyadmin under Actions: Server: dropdown *note: When connecting to a Godaddy DB, you must enable accessible [...]]]></description>
			<content:encoded><![CDATA[<p>C:\xampp\phpMyAdmin\config.inc.php</p>
<p>add this (or similar) at the bottom:</p>
<p><span style="color: #ff0000;">$i++;</span></p>
<p><span style="color: #ff0000;">$cfg['Servers'][$i]['auth_type'] = &#8216;config&#8217;;<br />
$cfg['Servers'][$i]['user'] = &#8216;user&#8217;;<br />
$cfg['Servers'][$i]['password'] = &#8216;password&#8217;;<br />
$cfg['Servers'][$i]['host'] = &#8216;your_host&#8217;;<br />
$cfg['Servers'][$i]['verbose'] = &#8216;Description to appear in phpMyAdmin&#8217;;</span></p>
<p><span style="color: #ff0000;">//end</span></p>
<p>params/reference: <a href="http://wiki.phpmyadmin.net/pma/Config" target="_blank">http://wiki.phpmyadmin.net/pma/Config</a></p>
<p>And then control remote MySQL databases in your localhost/phpmyadmin</p>
<p>under Actions: Server: dropdown</p>
<p><span style="color: #ff00ff;">*note: When connecting to a Godaddy DB, you must enable accessible remotely when creating the database!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/phpmyadmin-server-config/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP copyright year</title>
		<link>http://alexyz.com/php-copyright-year/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-copyright-year</link>
		<comments>http://alexyz.com/php-copyright-year/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 08:32:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=140</guid>
		<description><![CDATA[echo date("Y");]]></description>
			<content:encoded><![CDATA[<pre><span style="color: #ff0000;"><code>echo date("Y");</code></span></pre>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-copyright-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boot Startup Applications MSCONFIG</title>
		<link>http://alexyz.com/boot-startup-applications-msconfig/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=boot-startup-applications-msconfig</link>
		<comments>http://alexyz.com/boot-startup-applications-msconfig/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:36:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=137</guid>
		<description><![CDATA[Run MSCONFIG]]></description>
			<content:encoded><![CDATA[<p>Run</p>
<p>MSCONFIG</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/boot-startup-applications-msconfig/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl Regular Expressions cheat sheet</title>
		<link>http://alexyz.com/perl-regular-expressions-cheat-sheet/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=perl-regular-expressions-cheat-sheet</link>
		<comments>http://alexyz.com/perl-regular-expressions-cheat-sheet/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:35:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=135</guid>
		<description><![CDATA[/.*/ : matches anything /.*oose/ : wild card .* [] : class [a-z] : any lower case letter [A-Z] : any upper case letter [a-zA-Z] : any upper or lower case letter, notice runs together [a-zA-Z0-9] : any upper/lower or zero to nine [ a-z] : any lower case letter OR a space! [\-] : [...]]]></description>
			<content:encoded><![CDATA[<p>/.*/ : matches anything<br />
/.*oose/ : wild card .*</p>
<p>[] : class<br />
[a-z] : any lower case letter<br />
[A-Z] : any upper case letter<br />
[a-zA-Z] : any upper or lower case letter, notice runs together<br />
[a-zA-Z0-9] : any upper/lower or zero to nine<br />
[ a-z] : any lower case letter OR a space!<br />
[\-] : any hyphen, notice the excerpting from special inner  expression functionality \<br />
[^a] : negated class, match if sentence does NOT have &#8216;a&#8217;</p>
<p>shorthands:<br />
\d = [0-9]<br />
\D = [^0-9]<br />
\w = [a-zA-Z0-9_]<br />
\s = [ \t\n\r\f]<br />
\S = [^ \t\n\r\f]</p>
<p>In search string NOT classes additional things:<br />
^ at beginning means it must start to match<br />
$ at the end means it must end to match<br />
\b then string means must be beginning of word<br />
string then \b means it must be end of word<br />
\B before or after means it must NOT be start or end</p>
<p>example:<br />
my $example = &#8220;This is still a very strange sentence&#8221;;<br />
if($example =~ m/\bstill\b/){ print &#8220;This string HAS the exact word  &#8216;still&#8217; in it somewhere at least once, not a variation thereof such as  stillness&#8221;; }</p>
<p>example 2:<br />
my $phone = (000) 000-0000;<br />
if($phone =~ /^\(\d\d\d\) \d\d\d\d$/) { print &#8220;phone number  formatted correctly&#8221;; }</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/perl-regular-expressions-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php db connection close()</title>
		<link>http://alexyz.com/php-db-connection-close/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-db-connection-close</link>
		<comments>http://alexyz.com/php-db-connection-close/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:33:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=131</guid>
		<description><![CDATA[@mysql_close($dblink); or the network persistence traffic cop might come calling&#8230;YOU]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">@mysql_close($dblink); </span></p>
<p>or the network persistence traffic cop might come calling&#8230;YOU</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-db-connection-close/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php simple phone format</title>
		<link>http://alexyz.com/php-simple-phone-format/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-simple-phone-format</link>
		<comments>http://alexyz.com/php-simple-phone-format/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:29:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=128</guid>
		<description><![CDATA[$phone = 3334449999; $phone = preg_replace(&#8220;/([0-9a-zA-Z]{3})([0-9a-zA-Z]{3})([0-9a-zA-Z]{4})/&#8221;, &#8220;($1) $2-$3&#8243;, $phone);]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">$phone = 3334449999;<br />
$phone =  preg_replace(&#8220;/([0-9a-zA-Z]{3})([0-9a-zA-Z]{3})([0-9a-zA-Z]{4})/&#8221;, &#8220;($1)  $2-$3&#8243;, $phone);</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-simple-phone-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL comments</title>
		<link>http://alexyz.com/mysql-comments/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-comments</link>
		<comments>http://alexyz.com/mysql-comments/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:27:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=125</guid>
		<description><![CDATA[start of line left only (must have space after dashes): &#8211; comment OR /* */ example: if(!$result = mysql_query(&#8221; SELECT products_id, FROM runwayProductInfo, WHERE products_id IN (&#8217;545&#8242;,&#8217;100&#8242;) /* hello */ &#8211; comment ORDER BY FIELD(runwayProductInfo.products_id, &#8217;100&#8242;,&#8217;545&#8242;) &#8220;)){ echo mysql_error(); exit; }]]></description>
			<content:encoded><![CDATA[<p>start of line left only (must have space after  dashes):<br />
<strong>&#8211; comment</strong></p>
<p>OR<br />
<strong>/* */</strong></p>
<p>example:</p>
<p>if(!$result = mysql_query(&#8221;<br />
SELECT<br />
products_id,<br />
FROM<br />
runwayProductInfo,<br />
WHERE<br />
products_id IN (&#8217;545&#8242;,&#8217;100&#8242;)<br />
/* hello */<br />
&#8211; comment<br />
ORDER BY FIELD(runwayProductInfo.products_id, &#8217;100&#8242;,&#8217;545&#8242;)<br />
&#8220;)){ echo mysql_error(); exit; }</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/mysql-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php MySQL query shortcut syntax</title>
		<link>http://alexyz.com/php-mysql-query-shortcut-syntax/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-mysql-query-shortcut-syntax</link>
		<comments>http://alexyz.com/php-mysql-query-shortcut-syntax/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 06:26:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=123</guid>
		<description><![CDATA[$query = &#8220;SELECT o.FirstName, o.LastName, o.Addr1, o.Addr2, o.City, s.Name AS State, s.Abbrv as StateAbbrv, o.ZipCode, o.Phone1, o.EmailAddr, o.CCLastFour, o.CCExp, o.PromoCode FROM orders o INNER JOIN states s ON s.StateID = o.StateID WHERE o.OrderID = &#8221; . $this-&#62;_orderID;]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">$query  = &#8220;SELECT<br />
o.FirstName, o.LastName, o.Addr1, o.Addr2, o.City,<br />
s.Name AS State, s.Abbrv as StateAbbrv, o.ZipCode,<br />
o.Phone1, o.EmailAddr, o.CCLastFour, o.CCExp,  o.PromoCode<br />
FROM orders o<br />
INNER JOIN states s ON s.StateID = o.StateID<br />
WHERE o.OrderID = &#8221; . $this-&gt;_orderID;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-mysql-query-shortcut-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS link rollover class change</title>
		<link>http://alexyz.com/css-link-rollover-class-change/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-link-rollover-class-change</link>
		<comments>http://alexyz.com/css-link-rollover-class-change/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:24:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=120</guid>
		<description><![CDATA[&#60;a onMouseOver=&#8221;this.className=&#8217;on&#8217;&#8221; onMouseOut=&#8221;this.className=&#8217;off&#8217;&#8221; href=&#8221;10_9_08 MEETING.mp3&#8243;&#62;October 9, 2008&#60;/a&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;a  <span style="color: #008000;">onMouseOver=&#8221;this.className=&#8217;on&#8217;&#8221; onMouseOut=&#8221;this.className=&#8217;off&#8217;&#8221;</span> href=&#8221;10_9_08 MEETING.mp3&#8243;&gt;October 9, 2008&lt;/a&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/css-link-rollover-class-change/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE height CSS sheet hack example</title>
		<link>http://alexyz.com/ie-height-css-sheet-hack-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ie-height-css-sheet-hack-example</link>
		<comments>http://alexyz.com/ie-height-css-sheet-hack-example/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:23:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=118</guid>
		<description><![CDATA[.class_name { min-height: 10px; height: auto !important; /*ie6 min-height hack*/ height: 10px; }]]></description>
			<content:encoded><![CDATA[<p>.class_name {<br />
min-height: 10px;<br />
height: auto !important;<br />
/*ie6 min-height hack*/<br />
height: 10px;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/ie-height-css-sheet-hack-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>load IE only CSS stylesheet</title>
		<link>http://alexyz.com/load-ie-only-css-stylesheet/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=load-ie-only-css-stylesheet</link>
		<comments>http://alexyz.com/load-ie-only-css-stylesheet/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:22:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=116</guid>
		<description><![CDATA[&#60;!&#8211;[if IE]&#62;&#60;style type=&#8221;text/css&#8221;&#62;@import &#8220;css/ie_overide.css&#8221;;&#60;/style&#62; &#60;![endif]&#8211;&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;!&#8211;[if IE]&gt;&lt;style  type=&#8221;text/css&#8221;&gt;@import &#8220;css/ie_overide.css&#8221;;&lt;/style&gt;  &lt;![endif]&#8211;&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/load-ie-only-css-stylesheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dreamweaver Turn OFF Design Notes</title>
		<link>http://alexyz.com/dreamweaver-turn-off-design-notes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dreamweaver-turn-off-design-notes</link>
		<comments>http://alexyz.com/dreamweaver-turn-off-design-notes/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:21:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Dreamweaver]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=114</guid>
		<description><![CDATA[Manage Sites Edit Site Left hand column &#8216;Design Notes&#8217; Uncheck! much cleaner SVN]]></description>
			<content:encoded><![CDATA[<p>Manage Sites<br />
Edit Site<br />
Left hand column &#8216;Design Notes&#8217;<br />
Uncheck!</p>
<p>much cleaner SVN</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/dreamweaver-turn-off-design-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript image preloader script</title>
		<link>http://alexyz.com/javascript-image-preloader-script/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-image-preloader-script</link>
		<comments>http://alexyz.com/javascript-image-preloader-script/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:17:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=110</guid>
		<description><![CDATA[var myimages = new Array(); function preloading(){ for (x=0; x&#60;preloading.arguments.length; x++) { myimages[x] = new Image(); myimages[x].src = preloading.arguments[x]; } } preloading( &#8216;images/1.jpg&#8217;, &#8216;images/2.jpg&#8217;, &#8216;and_so_on.jpg&#8217;);]]></description>
			<content:encoded><![CDATA[<p><span style="color: #008000;">var myimages = new Array();</span></p>
<p><span style="color: #008000;">function preloading(){</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">for (x=0; x&lt;preloading.arguments.length; x++)<br />
{</span></p>
<p style="padding-left: 60px;"><span style="color: #008000;">myimages[x] = new Image();<br />
myimages[x].src = preloading.arguments[x];</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">}</span></p>
<p><span style="color: #008000;">}</span></p>
<p><span style="color: #008000;">preloading(<br />
&#8216;images/1.jpg&#8217;,<br />
&#8216;images/2.jpg&#8217;,<br />
&#8216;and_so_on.jpg&#8217;)</span>;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-image-preloader-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>script.aculo.us Scroll to top of page</title>
		<link>http://alexyz.com/script-aculo-us-scroll-to-top-of-page/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=script-aculo-us-scroll-to-top-of-page</link>
		<comments>http://alexyz.com/script-aculo-us-scroll-to-top-of-page/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:16:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[script.aculo.us]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=108</guid>
		<description><![CDATA[/* Scroll to Top of Page Functino */ var scroll = { top: function(event) { new Effect.ScrollTo(&#8216;top&#8217;, {duration: 1.0}); } } in html place something like: &#60;div id=&#8221;top&#8221; style=&#8221;visibility:hidden;&#8221;&#62;&#60;/div&#62; in onclick or elsewhere place: scroll.top();]]></description>
			<content:encoded><![CDATA[<p>/* Scroll to Top of Page  Functino */<br />
<span style="color: #008000;">var  scroll = {	top: function(event) { new Effect.ScrollTo(&#8216;top&#8217;,  {duration: 1.0}); } }<br />
</span><br />
in html place something like:</p>
<p>&lt;div id=&#8221;top&#8221; style=&#8221;visibility:hidden;&#8221;&gt;&lt;/div&gt;</p>
<p>in onclick or elsewhere place:</p>
<p><span style="color: #008000;">scroll.top();</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/script-aculo-us-scroll-to-top-of-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery document ready</title>
		<link>http://alexyz.com/jquery-document-ready/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-document-ready</link>
		<comments>http://alexyz.com/jquery-document-ready/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:12:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=105</guid>
		<description><![CDATA[&#60;html&#62; &#60;head&#62; &#60;script src=&#8221;jquery.1.3.2.min.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62; &#60;script&#62; $(document).ready(function() { // display main_wrapper $(&#8216;.site_container&#8217;).css(&#8216;display&#8217;, &#8216;block&#8217;); }); &#60;/script&#62; &#60;/head&#62; &#60;body&#62; &#60;div id=&#8221;main_wrapper&#8221; style=&#8221;display:none;&#8221;&#62; Page Content &#60;/div&#62; &#60;/body&#62; &#60;/html&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;script src=&#8221;jquery.1.3.2.min.js&#8221;  type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
<span style="color: #008000;">&lt;script&gt;<br />
$(document).ready(function()<br />
{<br />
// display main_wrapper<br />
$(&#8216;.site_container&#8217;).css(&#8216;display&#8217;, &#8216;block&#8217;);<br />
});<br />
&lt;/script&gt; </span><br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;div id=&#8221;main_wrapper&#8221; style=&#8221;display:none;&#8221;&gt;<br />
Page Content<br />
&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/jquery-document-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript script.aculo.us Fade &amp; Appear + IE Internet Explorer FIX</title>
		<link>http://alexyz.com/javascript-script-aculo-us-fade-appear/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-script-aculo-us-fade-appear</link>
		<comments>http://alexyz.com/javascript-script-aculo-us-fade-appear/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:11:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[script.aculo.us]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=103</guid>
		<description><![CDATA[new Effect.Fade(&#8216;left_block3&#8242;, { duration: 0.5 }); new Effect.Appear(&#8216;left_block4&#8242;, { duration: 0.5, queue:&#8217;end&#8217; }); FULL CODE: Blocks that fade and appear look like this: &#60;div id=&#8221;block1&#8243; style=&#8221;display:none;&#8221;&#62; &#60;div id=&#8221;header3&#8243;&#62; &#60;div style=&#8221;position:absolute;top:0px;&#8221;&#62;&#60;img border=&#8221;0&#8243; align=&#8221;left&#8221; alt=&#8221;blah&#8221; src=&#8221;images/blah.gif&#8221;&#62;&#60;/div&#62; &#60;div style=&#8221;position:absolute;top:110px;right:0px;&#8221;&#62;&#60;img border=&#8221;0&#8243; align=&#8221;right&#8221; alt=&#8221;blah&#8221; src=&#8221;images/blah.gif&#8221;/&#62;&#60;/div&#62; &#60;div style=&#8221;position:absolute;top:25px;left:50px;margin-right:30px;width:290px;color:#2A5041;&#8221;&#62; &#60;em&#62;copy&#60;div style=&#8221;text-align:right;&#8221;&#62;&#38;mdash;P.R.&#60;/div&#62; &#60;/em&#62; &#60;/div&#62; &#60;/div&#62; &#60;/div&#62; CSS for blocks: #block1, #block2, #block3, #block4, [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #000080;">new  Effect.Fade(&#8216;left_block3&#8242;, { duration: 0.5 });<br />
new Effect.Appear(&#8216;left_block4&#8242;, { duration: 0.5, queue:&#8217;end&#8217; });</span><br />
<strong>FULL CODE:</strong></p>
<p><strong>Blocks that fade and appear look like this:</strong></p>
<p><span style="color: #008000;">&lt;div id=&#8221;block1&#8243; style=&#8221;display:none;&#8221;&gt;<br />
&lt;div id=&#8221;header3&#8243;&gt;<br />
&lt;div style=&#8221;position:absolute;top:0px;&#8221;&gt;&lt;img border=&#8221;0&#8243; align=&#8221;left&#8221; alt=&#8221;blah&#8221; src=&#8221;images/blah.gif&#8221;&gt;&lt;/div&gt;<br />
&lt;div style=&#8221;position:absolute;top:110px;right:0px;&#8221;&gt;&lt;img border=&#8221;0&#8243; align=&#8221;right&#8221; alt=&#8221;blah&#8221; src=&#8221;images/blah.gif&#8221;/&gt;&lt;/div&gt;<br />
&lt;div style=&#8221;position:absolute;top:25px;left:50px;margin-right:30px;width:290px;color:#2A5041;&#8221;&gt;<br />
&lt;em&gt;copy&lt;div style=&#8221;text-align:right;&#8221;&gt;&amp;mdash;P.R.&lt;/div&gt;<br />
&lt;/em&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;</span></p>
<p><strong><span style="color: #000000;">CSS for blocks:</span></strong></p>
<p><span style="color: #800000;">#block1, #block2, #block3, #block4, #block5, #block6, #block7, #block8, #block9 {<br />
float: left;<br />
position: absolute;<br />
left: 635px;<br />
top: 225px;<br />
height: 375px;<br />
width: 375px;<br />
font-family: Arial, Helvetica, sans-serif;<br />
font-size: 14px;<br />
color: #000000;<br />
padding-left: 0px;<br />
display: inline;<br />
line-height:1.5em;<br />
text-align:left;<br />
}</span></p>
<p><span style="color: #800000;">.smooth_it {<br />
width: 68px;<br />
height: 50px;<br />
}</span></p>
<p><strong>Full Javascript function:</strong></p>
<p>/* ROTATING BLOCK */<br />
var spot = 0;<br />
var how_many = 7;<br />
var current_rotator = &#8216;block1&#8242;;</p>
<p><span style="color: #000080;">function swap_block()<br />
{<br />
new Effect.Fade(current_rotator, { duration: 0.5, queue: &#8216;end&#8217; });<br />
spot++;<br />
if(spot == 8){ spot = 1; }<br />
current_rotator = &#8216;block&#8217; + spot;<br />
new Effect.Appear(current_rotator, { delay: 1.0, duration: 0.5, queue: &#8216;end&#8217; });<br />
rotatorer = setTimeout(&#8220;swap_block()&#8221;, 10000);<br />
}</span></p>
<p><span style="color: #000080;"><span style="color: #000000;">The keys, things to remember:</span></span></p>
<p><span style="color: #000080;"><span style="color: #000000;">CSS defines the outermost block div, NOT the inner div, but DO note that it has an inner wrapping div (header3) that is NOT CSS defined.</span></span></p>
<p><span style="color: #000080;"><span style="color: #000000;">The Internet Explorer IE fix is that if these things aren&#8217;t all perfectly done as described, IE simply won&#8217;t fade but will show/hide without transition, and furthermore, if the block&#8217;s background isn&#8217;t defined it may also granulate text rather than treat it as &#8220;has layout&#8221;.<br />
</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-script-aculo-us-fade-appear/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript URL tracker function array</title>
		<link>http://alexyz.com/javascript-url-tracker-function-array/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-url-tracker-function-array</link>
		<comments>http://alexyz.com/javascript-url-tracker-function-array/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:09:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=101</guid>
		<description><![CDATA[&#60;script&#62; /* URL Tracker */ last_page = new Array(); go_here = &#8221;; function tracker() { go_here = location.hash; go_here = go_here.substr(1); last_page.unshift(go_here); } function visit_last_remove_from_tracker() { go_here = last_page.shift(); //alert(go_here); if(go_here == &#8221;){go_here = &#8216;state_link_28&#8242;;} if(go_here == &#8216;undefined&#8217;){go_here = &#8216;state_link_28&#8242;;} return go_here; } &#60;/script&#62;]]></description>
			<content:encoded><![CDATA[<p><span style="color: #008000;">&lt;script&gt;<br />
</span></p>
<p><span style="color: #008000;">/* URL Tracker */<br />
last_page = new Array();<br />
go_here = &#8221;;</p>
<p>function tracker() </span> <span style="color: #008000;"><br />
{ </span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">go_here = location.hash;<br />
go_here = go_here.substr(1);<br />
last_page.unshift(go_here); </span></p>
<p><span style="color: #008000;">}</p>
<p>function visit_last_remove_from_tracker() </span> <span style="color: #008000;"><br />
{ </span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">go_here = last_page.shift();<br />
//alert(go_here);<br />
if(go_here == &#8221;){go_here = &#8216;state_link_28&#8242;;}<br />
if(go_here == &#8216;undefined&#8217;){go_here = &#8216;state_link_28&#8242;;}<br />
return go_here; </span></p>
<p><span style="color: #008000;">}</span></p>
<p><span style="color: #008000;">&lt;/script&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-url-tracker-function-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript URL sniffer forward redirect</title>
		<link>http://alexyz.com/javascript-url-sniffer-forward-redirect/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-url-sniffer-forward-redirect</link>
		<comments>http://alexyz.com/javascript-url-sniffer-forward-redirect/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:07:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=95</guid>
		<description><![CDATA[&#60;!&#8211;Let&#8217;s make sure this wasn&#8217;t loaded outside the framework! &#8211;&#62; &#60;script src=&#8221;../js/forwarder.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62; &#60;script&#62; function where_are_we(){ var pushoff = &#8220;http://url/folder1/base_url_for_site&#8221;; var str = window.location.toString(); var temp = new Array(); temp = str.split(/pages/); //alert(&#8217;0 &#8216; + temp[0] + &#8216; 1 &#8216; + temp[1]); switch(temp[1]) { case &#8216;/01.php&#8217;: window.location = &#8220;http://url/folder1/folder2/#state_lesson_more_1&#8243;; break; } //if(str.search(/pages/) != -1 ){ [...]]]></description>
			<content:encoded><![CDATA[<p>&lt;!&#8211;Let&#8217;s make sure this wasn&#8217;t  loaded outside the framework! &#8211;&gt;<br />
&lt;script src=&#8221;../js/forwarder.js&#8221;  type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;</p>
<p><span style="color: #008000;">&lt;script&gt;<br />
function where_are_we(){ </span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">var pushoff = &#8220;http://url/folder1/base_url_for_site&#8221;;<br />
var str = window.location.toString();<br />
var temp = new Array();<br />
temp = str.split(/pages/);<br />
//alert(&#8217;0 &#8216; + temp[0] + &#8216; 1 &#8216; + temp[1]);<br />
switch(temp[1])<br />
{ </span></p>
<p style="padding-left: 60px;"><span style="color: #008000;">case &#8216;/01.php&#8217;: window.location =  &#8220;http://url/folder1/folder2/#state_lesson_more_1&#8243;;	 break; </span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">}<br />
//if(str.search(/pages/) != -1 ){ window.location = push_off; } </span></p>
<p><span style="color: #008000;">}<br />
window.onload = where_are_we();</span></p>
<p><span style="color: #ff00ff;"><span style="color: #008000;">&lt;/script&gt;</span><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-url-sniffer-forward-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript use img onload tag to set variable</title>
		<link>http://alexyz.com/javascript-use-img-onload-tag-to-set-variable/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-use-img-onload-tag-to-set-variable</link>
		<comments>http://alexyz.com/javascript-use-img-onload-tag-to-set-variable/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:04:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=92</guid>
		<description><![CDATA[&#60;img onload=&#8221;javascript: number_of_accordians = 5;&#8221; src=&#8221;&#60;? echo $prefix; ?&#62;images/beauty-2.gif&#8221; border=&#8221;0&#8243; alt=&#8221; &#8221; style=&#8221;float:left; margin:0px 20px 15px 0;&#8221; /&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;img <span style="color: #008000;">onload=&#8221;javascript:  number_of_accordians = 5;&#8221;</span> src=&#8221;<span style="color: #ff0000;">&lt;? echo $prefix;  ?&gt;</span>images/beauty-2.gif&#8221; border=&#8221;0&#8243; alt=&#8221; &#8221; style=&#8221;float:left;  margin:0px 20px 15px 0;&#8221; /&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-use-img-onload-tag-to-set-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript getElementsByTagName anchor tag CSS function</title>
		<link>http://alexyz.com/javascript-getelementsbytagname-anchor-tag-css-function/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-getelementsbytagname-anchor-tag-css-function</link>
		<comments>http://alexyz.com/javascript-getelementsbytagname-anchor-tag-css-function/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 13:59:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=88</guid>
		<description><![CDATA[function anchorcss() { var elements = document.getElementsByTagName(&#8220;a&#8221;); var limit = elements.length; var i = 0; for(i=0;i&#60; limit;++i) { if(elements[i].getAttribute(&#8220;name&#8221;)) { elements[i].onmouseover = elements[i].style.color = &#8220;#140b48&#8243;; elements[i].onmouseover = elements[i].style.textDecoration = &#8220;none&#8221;; } } }]]></description>
			<content:encoded><![CDATA[<p><span style="color: #008000;">function  anchorcss() {</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">var elements = document.getElementsByTagName(&#8220;a&#8221;);<br />
var limit = elements.length;<br />
var i = 0;</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">for(i=0;i&lt; limit;++i)<br />
{</span></p>
<p style="padding-left: 60px;"><span style="color: #008000;">if(elements[i].getAttribute(&#8220;name&#8221;)) {</span></p>
<p style="padding-left: 90px;"><span style="color: #008000;">elements[i].onmouseover = elements[i].style.color = &#8220;#140b48&#8243;;<br />
elements[i].onmouseover = elements[i].style.textDecoration = &#8220;none&#8221;;</span></p>
<p style="padding-left: 60px;"><span style="color: #008000;">}</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;"> }</span></p>
<p><span style="color: #008000;">}</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/javascript-getelementsbytagname-anchor-tag-css-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Time Helper: how to use it in a view</title>
		<link>http://alexyz.com/cakephp-time-helper-how-to-use-it-in-a-view/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cakephp-time-helper-how-to-use-it-in-a-view</link>
		<comments>http://alexyz.com/cakephp-time-helper-how-to-use-it-in-a-view/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 13:30:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=77</guid>
		<description><![CDATA[First of all, in the controller, add it to the $helpers array: var $helpers = array(&#8216;Html&#8217;, &#8216;Form&#8217;, &#8216;Time&#8217;); Then in the corresponding view, call it like this: &#60;p&#62;Date Published: &#60;?=$time-&#62;nice($post['Post']['date']);?&#62;&#60;/p&#62; which effectively (in this case from the database in this example) turns this: 2010-01-02 21:54:00 into this: Sat, Jan 2nd 2010, 21:54 &#8212;- note: &#8212;- [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, in the controller, add it to the $helpers array:</p>
<p><span style="color: #ff0000;">var $helpers = array(&#8216;Html&#8217;, &#8216;Form&#8217;, &#8216;Time&#8217;);</span></p>
<p>Then in the corresponding view, call it like this:</p>
<p>&lt;p&gt;Date Published:<span style="color: #ff0000;"> &lt;?=$time-&gt;nice($post['Post']['date']);?&gt;</span>&lt;/p&gt;</p>
<p>which effectively (in this case from the database in this example) turns this: <strong>2010-01-02 21:54:00</strong></p>
<p>into this: <strong>Sat, Jan 2nd 2010, 21:54</strong></p>
<p><strong>&#8212;- note: &#8212;-<br />
</strong></p>
<p>without the <strong>Time </strong>helper we could of course do this specific thing with the plain &#8216;ol PHP date function this way:<strong><br />
</strong></p>
<p><span style="color: #ff0000;">&lt;?=date(&#8216;M jS Y, g:i a&#8217;,strtotime($post['Post']['date']));?&gt;</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">&#8212;-</span><br />
</span></p>
<p><span style="color: #ff0000;">$post['Post']['date']</span> is the value of the object <strong><span style="color: #000000;">Time </span></strong>will beautify, in this case</p>
<p>sent by the following function in the controller:</p>
<p><span style="color: #ff0000;">function view($id = null) {</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">if (!$id) {</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;">$this-&gt;Session-&gt;setFlash(__(&#8216;Invalid Post.&#8217;, true));<br />
$this-&gt;redirect(array(&#8216;action&#8217;=&gt;&#8217;index&#8217;));</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">}<br />
$this-&gt;set(&#8216;post&#8217;, $this-&gt;Post-&gt;read(null, $id));</span></p>
<p><span style="color: #ff0000;">}</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/cakephp-time-helper-how-to-use-it-in-a-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semantic value: ul li, ol li vs. dl dt dd</title>
		<link>http://alexyz.com/semantic-value-ul-li-ol-li-vs-dl-dt-dd/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=semantic-value-ul-li-ol-li-vs-dl-dt-dd</link>
		<comments>http://alexyz.com/semantic-value-ul-li-ol-li-vs-dl-dt-dd/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 12:58:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=72</guid>
		<description><![CDATA[&#60;dl&#62; &#60;dt&#62;Name: &#60;/dt&#62; &#60;dd&#62;John Don&#60;/dd&#62; &#60;dt&#62;Age: &#60;/dt&#62; &#60;dd&#62;64&#60;/dd&#62; &#60;dt&#62;Gender: &#60;/dt&#62; &#60;dd&#62;Male&#60;/dd&#62; &#60;dt&#62;Day of Birth:&#60;/dt&#62; &#60;dd&#62;12th May 1946&#60;/dd&#62; &#60;/dl&#62; VS. Unordered lists Use a &#60;ul&#62; tag where the order of items is not significant. Ordered lists Use an &#60;ol&#62; tag where the order of items is significant, e.g. listing events in time order, or race results]]></description>
			<content:encoded><![CDATA[<dl>
<dt>
<pre>&lt;dl&gt;</pre>
</dt>
<dt>
<pre style="padding-left: 30px;">&lt;dt&gt;Name: &lt;/dt&gt;
&lt;dd&gt;John Don&lt;/dd&gt;

&lt;dt&gt;Age: &lt;/dt&gt;
&lt;dd&gt;64&lt;/dd&gt;

&lt;dt&gt;Gender: &lt;/dt&gt;
&lt;dd&gt;Male&lt;/dd&gt;

&lt;dt&gt;Day of Birth:&lt;/dt&gt;
&lt;dd&gt;12th May 1946&lt;/dd&gt;</pre>
</dt>
<dt>
<pre>&lt;/dl&gt;</pre>
</dt>
<dt>
<pre><strong>VS.</strong></pre>
</dt>
<dt>Unordered lists </dt>
<dd>Use a <a href="http://www.webdesignfromscratch.com/html-tag-reference/html-unordered-list-ul-tag.php">&lt;ul&gt;</a> tag where the order of items is not  significant.</dd>
<dt>Ordered lists </dt>
<dd>Use an <a href="http://www.webdesignfromscratch.com/html-tag-reference/html-ordered-list-ol-tag.php">&lt;ol&gt;</a> tag where the order of items is  significant, e.g. listing events in time order, or race results</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/semantic-value-ul-li-ol-li-vs-dl-dt-dd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP debug</title>
		<link>http://alexyz.com/cakephp-debug/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cakephp-debug</link>
		<comments>http://alexyz.com/cakephp-debug/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 12:26:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=62</guid>
		<description><![CDATA[need to see inside that specified array? to be remembered: app/views/posts/view.ctp &#60;? debug($post); ?&#62; which will also display records from associated models!]]></description>
			<content:encoded><![CDATA[<p>need to see inside that specified array?</p>
<p>to be remembered:</p>
<p>app/views/posts/view.ctp</p>
<p><span style="color: #ff0000;">&lt;? debug($post); ?&gt;</span></p>
<p>which will also display records from associated models!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/cakephp-debug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress SESSIONS</title>
		<link>http://alexyz.com/wordpress-sessions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-sessions</link>
		<comments>http://alexyz.com/wordpress-sessions/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 12:36:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=59</guid>
		<description><![CDATA[simply add: session_start(); to the start of: wp-config.php right at the top, after &#60;?]]></description>
			<content:encoded><![CDATA[<p>simply add:</p>
<p><span style="color: #ff0000;">session_start();</span></p>
<p>to the start of:</p>
<p>wp-config.php</p>
<p>right at the top, after <span style="color: #ff0000;">&lt;?</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/wordpress-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>If homepage : do a second &#8220;Loop&#8221; to show current article &#8220;post&#8221; WordPress</title>
		<link>http://alexyz.com/if-homepage-do-a-second-loop-to-show-current-article-post-wordpress/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=if-homepage-do-a-second-loop-to-show-current-article-post-wordpress</link>
		<comments>http://alexyz.com/if-homepage-do-a-second-loop-to-show-current-article-post-wordpress/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 12:35:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=56</guid>
		<description><![CDATA[&#60;? if(is_front_page()) : ?&#62; &#60;? query_posts(&#8216;showposts=1&#8242;); ?&#62; &#60;?php while (have_posts()): the_post(); ?&#62; &#60;h2&#62;&#60;?php the_title(); ?&#62;&#60;/h2&#62; &#60;?php the_excerpt(); ?&#62; &#60;p&#62;&#60;a href=&#8221;&#60;?php the_permalink(); ?&#62;&#8220;&#62;Read more&#8230;&#60;/a&#62;&#60;/p&#62; &#60;?php endwhile; ?&#62; &#60;? endif; ?&#62;]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">&lt;? if(is_front_page()) : ?&gt;<br />
&lt;? query_posts(&#8216;showposts=1&#8242;); ?&gt;<br />
&lt;?php while (have_posts()): the_post(); ?&gt;<br />
<span style="color: #888888;">&lt;<span style="color: #000000;">h2&gt;</span></span>&lt;?php the_title(); ?&gt;<span style="color: #000000;">&lt;/h2&gt;</span><br />
&lt;?php the_excerpt(); ?&gt;<br />
<span style="color: #000000;">&lt;p&gt;</span><span style="color: #000000;">&lt;a href=&#8221;</span>&lt;?php the_permalink(); ?&gt;<span style="color: #000000;">&#8220;&gt;Read more&#8230;&lt;/a&gt;&lt;/p&gt;</span><br />
&lt;?php endwhile; ?&gt;<br />
&lt;? endif; ?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/if-homepage-do-a-second-loop-to-show-current-article-post-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Meta redirect 301 forward</title>
		<link>http://alexyz.com/html-meta-redirect-301-forward/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-meta-redirect-301-forward</link>
		<comments>http://alexyz.com/html-meta-redirect-301-forward/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 04:42:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=50</guid>
		<description><![CDATA[&#60;html&#62; &#60;head&#62; &#60;meta http-equiv=&#8221;refresh&#8221; content=&#8221;0;url=http://www.google.com&#8221;&#62; &#60;/head&#62; &#60;body&#62; &#60;a href=&#8221;http://www.google.com&#8221;&#62;This page has moved&#60;/a&#62; &#60;/body&#62; &#60;/html&#62;]]></description>
			<content:encoded><![CDATA[<p>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;refresh&#8221; content=&#8221;0;url=http://www.google.com&#8221;&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;a href=&#8221;http://www.google.com&#8221;&gt;This page has moved&lt;/a&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/html-meta-redirect-301-forward/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php Header 301 redirect examples</title>
		<link>http://alexyz.com/php-header-301-redirect-examples/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-header-301-redirect-examples</link>
		<comments>http://alexyz.com/php-header-301-redirect-examples/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 08:28:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=46</guid>
		<description><![CDATA[header(&#8220;HTTP/1.1 301 Moved Permanently&#8221;); header(&#8216;Location: &#8216; . $new_website_url . $append_qstrings); //echo $new_website_url . $append_qstrings; exit;]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">header(&#8220;HTTP/1.1 301 Moved  Permanently&#8221;);</span></p>
<p><span style="color: #ff0000;">header(&#8216;Location: &#8216; . $new_website_url . $append_qstrings);</span></p>
<p>//echo $new_website_url . $append_qstrings;<br />
<span style="color: #ff0000;">exit;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/php-header-301-redirect-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Location of Windows Hosts Host file</title>
		<link>http://alexyz.com/location-of-windows-hosts-host-file/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=location-of-windows-hosts-host-file</link>
		<comments>http://alexyz.com/location-of-windows-hosts-host-file/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 08:19:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=43</guid>
		<description><![CDATA[C:\WINDOWS\system32\drivers\etc\hosts forward browser requests for www.google.com instead to IP 192.162.1.1 example: 192.162.1.1 www.google.com]]></description>
			<content:encoded><![CDATA[<p>C:\WINDOWS\system32\drivers\etc\hosts</p>
<p>forward browser requests for www.google.com<br />
instead to IP 192.162.1.1<br />
example:</p>
<p><span style="color: #0000ff;">192.162.1.1     www.google.com</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/location-of-windows-hosts-host-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 Make Cursor a Hand</title>
		<link>http://alexyz.com/flash-actionscript-3-make-cursor-a-hand/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flash-actionscript-3-make-cursor-a-hand</link>
		<comments>http://alexyz.com/flash-actionscript-3-make-cursor-a-hand/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 05:59:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=35</guid>
		<description><![CDATA[The goal: SIMPLY turn the cursor into a hand (over something that really isn&#8217;t a button, in this case it&#8217;s just a dynamic URLREQUEST function/link). Nice and simple solution: top of your AS3 package: import flash.ui.Mouse; in function reacting to mouse movement or loader success: this.buttonMode = true;]]></description>
			<content:encoded><![CDATA[<p>The goal:</p>
<p><strong>SIMPLY turn the cursor into a hand </strong><br />
(over something that really isn&#8217;t a button, in this case it&#8217;s just a  dynamic URLREQUEST function/link).</p>
<p>Nice and simple solution:</p>
<p><span style="color: #ff00ff;"><span style="color: #000000;">top of your AS3 package:</span><br />
import flash.ui.Mouse;</span></p>
<p>in function reacting to mouse movement or loader success:<br />
<span style="color: #ff00ff;">this.buttonMode = true;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/flash-actionscript-3-make-cursor-a-hand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 Link</title>
		<link>http://alexyz.com/actionscript-3-link/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=actionscript-3-link</link>
		<comments>http://alexyz.com/actionscript-3-link/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 05:58:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=32</guid>
		<description><![CDATA[import flash.net.navigateToURL; this.addEventListener(MouseEvent.CLICK, fOnClick); private function fOnClick( e : MouseEvent ):void { var request:URLRequest = new URLRequest(&#8220;http://www.google.com&#8221;); navigateToURL(request); }]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff00ff;">import flash.net.navigateToURL;<br />
this.addEventListener(MouseEvent.CLICK, fOnClick);</span></p>
<p><span style="color: #ff00ff;">private function fOnClick( e : MouseEvent ):void {<br />
var request:URLRequest = new URLRequest(&#8220;http://www.google.com&#8221;);<br />
navigateToURL(request);<br />
}</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/actionscript-3-link/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Photoshop .ico plugin / Favicon instructions</title>
		<link>http://alexyz.com/photoshop-ico-plugin-instructions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=photoshop-ico-plugin-instructions</link>
		<comments>http://alexyz.com/photoshop-ico-plugin-instructions/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 15:25:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Photoshop]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=25</guid>
		<description><![CDATA[http://www.grafikhaus.co.uk/dwtutsfavicon.htm save to: program files/adobe/photoshop/plug-ins/file formats make it at 64 x 64 or 32 x 32, end at 16 x 16 insert into your doc: &#60;link rel=&#8221;Shortcut Icon&#8221; href=&#8221;/favicon.ico&#8221;&#62;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.grafikhaus.co.uk/dwtutsfavicon.htm" target="_blank">http://www.grafikhaus.co.uk/dwtutsfavicon.htm</a></p>
<p>save to:</p>
<p>program files/adobe/photoshop/plug-ins/file formats</p>
<p>make it at 64 x 64 or 32 x 32, end at 16 x 16</p>
<p>insert into your doc:</p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: x-small;">&lt;link rel=&#8221;Shortcut Icon&#8221; href=&#8221;/favicon.ico&#8221;&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/photoshop-ico-plugin-instructions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regex Expression Password Validation; 1 Uppercase; 1 Lowercase; 1 Number; length of 6 &#8211; 20</title>
		<link>http://alexyz.com/regex-expression-password-validation-1-uppercase-1-lowercase-1-number-length-of-6-20/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=regex-expression-password-validation-1-uppercase-1-lowercase-1-number-length-of-6-20</link>
		<comments>http://alexyz.com/regex-expression-password-validation-1-uppercase-1-lowercase-1-number-length-of-6-20/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 15:03:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=21</guid>
		<description><![CDATA[function valPassword($Password){ $pRegex = &#8216;/(?-i)(?m)^(?=.*?\d)(?=.*?[a-z])(?=.*?[A-Z])[a-zA-Z].{6,20}$/&#8217;; if ( preg_match($pRegex, $Password)) { return TRUE; } return FALSE; } Or this also works nicely: function valPassword($Password) { if( ctype_alnum($Password) // numbers &#38; digits only &#38;&#38; strlen($Password)&#62;6 // at least 7 chars //&#38;&#38; strlen($password)&#60;21 // at most 20 chars &#38;&#38; preg_match(&#8216;`[A-Z]`&#8217;,$Password) // at least one upper case &#38;&#38; preg_match(&#8216;`[a-z]`&#8217;,$Password) [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">function valPassword($Password){</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">$pRegex = &#8216;/(?-i)(?m)^(?=.*?\d)(?=.*?[a-z])(?=.*?[A-Z])[a-zA-Z].{6,20}$/&#8217;;</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">if ( preg_match($pRegex, $Password)) { return TRUE; }<br />
return FALSE;</span></p>
<p><span style="color: #ff0000;">}</span></p>
<p><strong>Or this also works nicely:</strong></p>
<p><span style="color: #ff0000;">function valPassword($Password)</span></p>
<p><span style="color: #ff0000;">{</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">if(<br />
ctype_alnum($Password) <span style="color: #000000;">// numbers &amp; digits only</span><br />
&amp;&amp; strlen($Password)&gt;6 <span style="color: #000000;">// at least 7 chars</span><br />
//&amp;&amp; strlen($password)&lt;21 <span style="color: #000000;">// at most 20 chars</span><br />
&amp;&amp; preg_match(&#8216;`[A-Z]`&#8217;,$Password) <span style="color: #000000;">// at least one upper case</span><br />
&amp;&amp; preg_match(&#8216;`[a-z]`&#8217;,$Password) <span style="color: #000000;">// at least one lower case</span><br />
&amp;&amp; preg_match(&#8216;`[0-9]`&#8217;,$Password) <span style="color: #000000;">// at least one digit</span></span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">)</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">{</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;">return TRUE;</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">}<br />
return FALSE;</span></p>
<p><span style="color: #ff0000;">}</span></p>
<p><strong>Resource:</strong></p>
<p><a href="http://regexlib.com/REDetails.aspx?regexp_id=31">http://regexlib.com/REDetails.aspx?regexp_id=31</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/regex-expression-password-validation-1-uppercase-1-lowercase-1-number-length-of-6-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Setting up command line to bake</title>
		<link>http://alexyz.com/cakephp-setting-up-command-line-to-bake/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cakephp-setting-up-command-line-to-bake</link>
		<comments>http://alexyz.com/cakephp-setting-up-command-line-to-bake/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 15:34:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=11</guid>
		<description><![CDATA[http://i.justrealized.com/2009/02/16/how-to-run-xampps-php-cli-and-cakephp-console/ start baking: C:\xampp\htdocs\project\app&#62;&#8221;../cake/console/cake&#8221; bake]]></description>
			<content:encoded><![CDATA[<p><a href="http://i.justrealized.com/2009/02/16/how-to-run-xampps-php-cli-and-cakephp-console/" target="_blank">http://i.justrealized.com/2009/02/16/how-to-run-xampps-php-cli-and-cakephp-console/</a></p>
<p>start baking:</p>
<p><strong>C:\xampp\htdocs\project\app&gt;&#8221;../cake/console/cake&#8221; bake</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/cakephp-setting-up-command-line-to-bake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inline Javascript CSS properties</title>
		<link>http://alexyz.com/inline-javascript-css-properties/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=inline-javascript-css-properties</link>
		<comments>http://alexyz.com/inline-javascript-css-properties/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 13:55:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=7</guid>
		<description><![CDATA[Inline Javascript CSS properties dash replaced by capital &#60;a href=&#8221;#&#8221; onmouseover=&#8221;this.style.textDecoration=&#8217;none&#8217;&#8221; onmouseout=&#8221;this.style.textDecoration=&#8217;underline&#8217;&#8221; style=&#8221;color:#FFFFFF text-decoration:underline;&#8221; &#62; Details &#60;/a&#62;]]></description>
			<content:encoded><![CDATA[<p>Inline Javascript CSS properties</p>
<p>dash replaced by capital</p>
<p>&lt;a<br />
href=&#8221;#&#8221;<br />
<span style="color: #008000;">onmouseover=&#8221;this.style.textDecoration=&#8217;none&#8217;&#8221;<br />
onmouseout=&#8221;this.style.textDecoration=&#8217;underline&#8217;&#8221;</span><br />
style=&#8221;color:#FFFFFF text-decoration:underline;&#8221;<br />
&gt;<br />
Details<br />
&lt;/a&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/inline-javascript-css-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending mail xampp gmail</title>
		<link>http://alexyz.com/sending-mail-xampp-gmail/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sending-mail-xampp-gmail</link>
		<comments>http://alexyz.com/sending-mail-xampp-gmail/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 21:21:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://alexyz.com/?p=506</guid>
		<description><![CDATA[source/reference: http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/ If you&#8217;re developing on your local xampp environment, eventually you will need your apps to actually send mail: Change the following lines in your php.ini (usually here C:\xampp\php\php.ini, but possibly also php5.ini, and/or C:\xampp\apache\bin\php.ini): SMTP = smtp.gmail.com smtp_port = 587 sendmail_from = [your_gmail_username]@gmail.com] sendmail_path = &#8220;:\&#8221;C:\xampp\sendmail\sendmail.exe\&#8221; -t&#8221; Change your sendmail.ini to read as [...]]]></description>
			<content:encoded><![CDATA[<p>source/reference:</p>
<p><a href="http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/">http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/</a></p>
<p>If you&#8217;re developing on your local xampp environment, eventually you will need your apps to actually send mail:</p>
<p><strong>Change the following lines in your <span style="color: #0000ff;">php.ini</span></strong><br />
(usually here <em>C:\xampp\php\php.ini</em>, but possibly also <em>php5.ini</em>, and/or <em>C:\xampp\apache\bin\php.ini</em>):</p>
<p>SMTP = smtp.gmail.com<br />
smtp_port = 587<br />
sendmail_from = <a href="mailto:youremail@gmail.com">[your_gmail_username]@gmail.com</a><span style="color: #0000ff;">]</span><br />
sendmail_path = &#8220;:\&#8221;C:\xampp\sendmail\sendmail.exe\&#8221; -t&#8221;</p>
<p><strong>Change your <span style="color: #0000ff;">sendmail.ini</span></strong> to read as follows (again, usually C:\xampp\sendmail\sendmail.ini):</p>
<p>account Gmail<br />
tls on<br />
tls_certcheck off<br />
host smtp.gmail.com<br />
from <a href="mailto:youremail@gmail.com">[your_gmail_username]@gmail.com</a><span style="color: #0000ff;">]</span><br />
auth on<br />
user <a href="mailto:youremail@gmail.com">[your_gmail_username]@gmail.com</a><span style="color: #0000ff;">]</span><br />
password <a href="mailto:youremail@gmail.com">[your_gmail_username]@gmail.com</a><br />
port 587<br />
account default : Gmail</p>
<p><strong>Simple example test script to see that it worked:</strong></p>
<p><span style="color: #ff0000;">&lt;?php</span><br />
$from_name = &#8220;yourName&#8221;;<br />
$from_email = &#8220;whichEver@gmail.com&#8221;;<br />
$headers = &#8220;From: $from_name &lt;$from_email&gt;&#8221;;<br />
$body = &#8220;Hi, \nThis is a test mail from $from_name &lt;$from_email&gt;.&#8221;;<br />
$subject = &#8220;Mail from my development environment&#8221;;<br />
$to = &#8220;yourUserNameHere@gmail.com&#8221;;</p>
<p>if (mail($to, $subject, $body, $headers)) {<br />
echo &#8220;success!&#8221;;<br />
} else {<br />
echo &#8220;fail…&#8221;;<br />
}<br />
<span style="color: #ff0000;">?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alexyz.com/sending-mail-xampp-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

