<?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>Geekinator.com &#187; Programming</title>
	<atom:link href="http://www.geekinator.com/category/programmng/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekinator.com</link>
	<description></description>
	<lastBuildDate>Sat, 29 Oct 2011 14:49:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>A field not saving in CakePHP? Try clearing the cache :)</title>
		<link>http://www.geekinator.com/2011/10/24/a-field-not-saving-in-cakephp-try-clearing-the-cache/</link>
		<comments>http://www.geekinator.com/2011/10/24/a-field-not-saving-in-cakephp-try-clearing-the-cache/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 23:03:46 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[field]]></category>

		<guid isPermaLink="false">http://www.geekinator.com/?p=195</guid>
		<description><![CDATA[I thought I&#8217;d pass a little tip along for those of you who use the CakePHP framework, and maybe don&#8217;t know all the ins and outs yet (I am definitely one of those people, but I&#8217;m getting there). Every once in a while, I&#8217;ll get stuck on something that just won&#8217;t save to the database, [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d pass a little tip along for those of you who use the CakePHP framework, and maybe don&#8217;t know all the ins and outs yet (I am definitely one of those people, but I&#8217;m getting there). Every once in a while, I&#8217;ll get stuck on something that just won&#8217;t save to the database, and all of a sudden it will dawn on me that I haven&#8217;t cleared the model cache (the cached model files are located in /app/tmp/cache/models/).</p>
<p>If you have loaded any models on your site, and then make changes to those models at a later time, you will need to clear the model cache for the particular model before Cake will be able to see the new database changes. </p>
<p>I just remembered that, as I&#8217;ve been yelling at the screen for the past hour, trying to figure out why a simple integer field would not save to the database&#8230;well, if I had my brain plugged in, I would have remembered I renamed the field in the database after I had already loaded the particular model on my site&#8230;duh!!!</p>
<p>Anyway, this tip always saves the day, whenever I can remember what the problem is <img src='http://www.geekinator.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I hope it helps anyone else out there in the same boat.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2011/10/24/a-field-not-saving-in-cakephp-try-clearing-the-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate Multiple Models at same time when using CakePHP Wizard component</title>
		<link>http://www.geekinator.com/2011/10/24/validate-multiple-models-at-same-time-when-using-cakephp-wizard-component/</link>
		<comments>http://www.geekinator.com/2011/10/24/validate-multiple-models-at-same-time-when-using-cakephp-wizard-component/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 16:25:13 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[validate]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[wizard]]></category>

		<guid isPermaLink="false">http://www.geekinator.com/?p=175</guid>
		<description><![CDATA[I really like the CakePHP Wizard component, written by Jared Hoyt and can be found at http://bakery.cakephp.org/articles/jaredhoyt/2010/09/10/wizard-component-1-2-tutorial#page-2. It&#8217;s great for creating multi page web forms in CakePHP, but I did run across a little problem (I&#8217;m sure it&#8217;s not a glitch with the component, but just a problem I&#8217;m having with my situation). The problem [...]]]></description>
			<content:encoded><![CDATA[<p>I really like the CakePHP Wizard component, written by Jared Hoyt and can be found at<br />
<a href="http://bakery.cakephp.org/articles/jaredhoyt/2010/09/10/wizard-component-1-2-tutorial#page-2" target="_blank">http://bakery.cakephp.org/articles/jaredhoyt/2010/09/10/wizard-component-1-2-tutorial#page-2</a>.<br />
It&#8217;s great for creating multi page web forms in CakePHP, but I did run across a little problem (I&#8217;m sure it&#8217;s not a glitch with the component, but just a problem I&#8217;m having with my situation). The problem I ran across is when a single page in the form contains fields from multiple models, validation errors are not shown for every model, but only one at a time. </p>
<p>For example, if page 1 of the form (or any page for that matter) contains fields for the Person model AND the Address model, and the &#8220;Person&#8221; fields come before the &#8220;Address&#8221; fields, when the form is submitted, all of the validation rules must pass on the Person model before the validation is run on the Address model. The problem with this, is the only validation errors that are shown will be the Person model errors, until those validation rules pass.</p>
<p>Fortunately, I found a very easy fix for this problem at<br />
<a href="http://cobaia.net/2011/01/cakephp-one-form-with-multiple-model-validate-and-form-display-errors/" target="_blank">http://cobaia.net/2011/01/cakephp-one-form-with-multiple-model-validate-and-form-display-errors/</a><br />
It wasn&#8217;t necessarily pertaining to the Wizard component, but it works just the same.</p>
<p>All you need to do, is inside the process methods for each step, before the $this->Model->validates() checks, add this little snippet of code (change the word Model to the name of your particular controller&#8217;s model &#8212; In my case, my form is processed inside a controller called &#8220;Applications&#8221; and it has a model called &#8220;Application&#8221; which I use to store basic information about the submitted form&#8230;I then house various other pieces of data from the form inside associated tables (models)):</p>
<div class="dirtycodenoclick"><code><br />
 if(!empty($this-&gt;data)){<br />
&nbsp;&nbsp; $this-&gt;Model-&gt;saveAll($this-&gt;data, array(&#039;validate&#039; =&gt; &#039;only&#039;));<br />
&nbsp;&nbsp; $this-&gt;set(&#039;errors&#039;, $this-&gt;Model-&gt;validationErrors);<br />
 }else{<br />
&nbsp;&nbsp; $this-&gt;set(&#039;errors&#039;,array());<br />
 }<br />
</code></div>
<p>If you need to see this in context, here is the entire process method for one of my form pages:</p>
<div class="dirtycodenoclick"><code><br />
function _processPage1() {<br />
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;Application-&gt;set($this-&gt;data);<br />
	 $this-&gt;Application-&gt;Person-&gt;set($this-&gt;data);<br />
	 $this-&gt;Application-&gt;Address-&gt;set($this-&gt;data);</p>
<p>	 if(!empty($this-&gt;data)){<br />
	&nbsp;&nbsp; $this-&gt;Application-&gt;saveAll($this-&gt;data, array(&#039;validate&#039; =&gt; &#039;only&#039;));<br />
	&nbsp;&nbsp; $this-&gt;set(&#039;errors&#039;, $this-&gt;Application-&gt;validationErrors);<br />
	 }else{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;set(&#039;errors&#039;,array());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>	 if($this-&gt;Application-&gt;Person-&gt;validates() &amp;&amp; $this-&gt;Application-&gt;Address-&gt;validates()) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; return false;<br />
&nbsp;&nbsp; }<br />
</code></div>
<p>Of course, I&#8217;ve simplified my process method quite a bit, but it would be a functional method if your controller&#8217;s model was called Application and your form had fields from both a Person model and Address model.</p>
<p>The line that sets the errors variable is optional. I like to display all of the errors at the top of the page, as well as below the invalid field.</p>
<p>I hope that helps others who are having the same issue as I did!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2011/10/24/validate-multiple-models-at-same-time-when-using-cakephp-wizard-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Populate State List on Country Select in CakePHP using jQuery</title>
		<link>http://www.geekinator.com/2011/03/25/populate-state-list-on-country-select-in-cakephp-using-jquery/</link>
		<comments>http://www.geekinator.com/2011/03/25/populate-state-list-on-country-select-in-cakephp-using-jquery/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 19:28:45 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery cookie]]></category>
		<category><![CDATA[state dropdown list]]></category>

		<guid isPermaLink="false">http://www.geekinator.com/?p=153</guid>
		<description><![CDATA[This has been shown on many sites, but it took the combination of several articles for me to figure this one out&#8230;maybe it&#8217;s just me, dunno. Also, it drove me nuts how the states list would disappear if the page was refreshed. I learned how to handle that as well, using jQuery cookies. By the [...]]]></description>
			<content:encoded><![CDATA[<p>This has been shown on many sites, but it took the combination of several articles for me to figure this one out&#8230;maybe it&#8217;s just me, dunno.</p>
<p>Also, it drove me nuts how the states list would disappear if the page was refreshed. I learned how to handle that as well, using jQuery cookies.</p>
<p>By the way, here&#8217;s the versions of cakephp, jquery and plugins I am using:</p>
<p>CakePHP version 1.3.7<br />
jQuery version 1.5 (I just used the minified version, not that is should matter)<br />
jQuery cookie plugin version 1.0</p>
<p>Not that it matters at all, but for those who may have problems and are wondering what database I&#8217;m running, it&#8217;s MySQL version 5.1.41 (at least that&#8217;s the client I&#8217;m running&#8230;the server number may or may not be different). I am testing this using XAMPP 1.7.3 for Windows in Windows 7.</p>
<p>Here&#8217;s the steps:</p>
<p>***********************<br />
STEP 1<br />
***********************<br />
Add the following to your view file (whatever file contains the form that houses country and state select fields):</p>
<div class="dirtycodenoclick"><code><br />
&lt;?php<br />
echo $this-&gt;Form-&gt;input(&#039;country_id&#039;,array(&#039;id&#039; =&gt; &#039;country_id&#039;,&#039;label&#039; =&gt; &#039;Country&#039;,&#039;error&#039; =&gt; false,&#039;empty&#039; =&gt; false));<br />
<br />echo $this-&gt;Form-&gt;input(&#039;state_id&#039;,array(&#039;id&#039; =&gt; &#039;state&#039;,&#039;label&#039; =&gt; &#039;State/Province&#039;,&#039;error&#039; =&gt; false,&#039;empty&#039; =&gt; &#039;Select Country First&#039;));<br />
?&gt;<br />
</code></div>
<p>***********************<br />
STEP 2<br />
***********************<br />
Create a model file for country and one for state:</p>
<p>&#8212; /app/models/country.php &#8212;</p>
<div class="dirtycodenoclick"><code><br />
&lt;?php<br />
# /app/models/country.php<br />
class Country extends AppModel {<br />
var $name = &#039;Country&#039;;<br />
var $hasMany = array(&#039;NameOfYourControllerModelGoesHere&#039;);<br />
}<br />
?&gt;<br />
</code></div>
<p>&#8212; /app/models/state.php &#8212;</p>
<div class="dirtycodenoclick"><code><br />
&lt;?php<br />
# /app/models/state.php<br />
class State extends AppModel {<br />
var $name = &#039;State&#039;;<br />
var $hasMany = array(&#039;NameOfYourControllerModelGoesHere&#039;);<br />
}<br />
?&gt;<br />
</code></div>
<p>***********************<br />
STEP 3<br />
***********************<br />
Add the following action to your controller.php file (whichever controller file you are using to control the form)</p>
<div class="dirtycodenoclick"><code><br />
function get_states($country_id = null){<br />
$this-&gt;layout = &#039;ajax&#039;;<br />
$this-&gt;set(&#039;states&#039;,$this-&gt;NameOfYourControllerModelGoesHere-&gt;State-&gt;find(&#039;list&#039;,array(&#039;conditions&#039;=&gt;array(&#039;State.country_id&#039; =&gt; $country_id))));<br />
}<br />
</code></div>
<p>***********************<br />
STEP 4<br />
***********************<br />
Create a view file for the action you just created, inside /app/views/NameOfYourControllerGoesHere/get_states.ctp</p>
<p>then, add the following to that file:</p>
<div class="dirtycodenoclick"><code><br />
&lt;?php<br />
# /app/views/NameOfYourControllerGoesHere/get_states.ctp<br />
?&gt;<br />
&lt;option&gt;Select a State/Province&lt;/option&gt;<br />
&lt;?php<br />
foreach($states as $stateId=&gt;$stateName){<br />
echo &#039;<br />
&lt;option value=&quot;&#039;.$stateId.&#039;&quot;&gt;&#039;.$stateName.&#039;&lt;/option&gt;&#039;.&quot;\n&quot;;<br />
}<br />
?&gt;<br />
</code></div>
<p>***********************<br />
STEP 5<br />
***********************<br />
Download the jQuery cookie plugin from</p>
<p>http://plugins.jquery.com/files/jquery.cookie.js.txt</p>
<p>copy the contents of jquery.cookie.js.txt into /app/webroot/js/jquery.cookie.js</p>
<p>***********************<br />
STEP 6<br />
***********************<br />
If you don&#8217;t already have jQuery installed, you can download the latest version by going to www.jquery.com and click the download button (I&#8217;m using version 1.5, but I would imagine this code will still work with future versions)</p>
<p>Once you have both jQuery and jQuery cookie plugin installed, add this to the view file containing your form:</p>
<div class="dirtycodenoclick"><code><br />
&lt;?php<br />
echo $this-&gt;Html-&gt;script(&#039;jquery&#039;, false);<br />
echo $this-&gt;Html-&gt;script(&#039;jquery.cookie&#039;,false);<br />
?&gt;<br />
</code></div>
<p>***********************<br />
STEP 7<br />
***********************<br />
Add the following to either your layout file or to the view file that contains your form:</p>
<div class="dirtycodenoclick"><code><br />
&lt;script type=&quot;text/javascript&quot;&gt;<br />
$(document).ready(function() {<br />
if($.cookie(&quot;selectedCountry&quot;) == null){<br />
&nbsp;&nbsp;/* default to United States */<br />
$(&quot;#country_id&quot;).val( 1 ).attr(&#039;selected&#039;,true);<br />
 $(&#039;#state&#039;).load(&#039;NameOfYourControllerGoesHere/get_states/1&#039;);<br />
}else{<br />
&nbsp;&nbsp; $(&quot;#country_id&quot;).val( $.cookie(&quot;selectedCountry&quot;) ).attr(&#039;selected&#039;,true);<br />
&nbsp;&nbsp; $(&#039;#state&#039;).load(&#039;NameOfYourControllerGoesHere/get_states/&#039;+$.cookie(&quot;selectedCountry&quot;));<br />
}<br />
<br /> $(&#039;#country_id&#039;).change(function() {<br />
&nbsp;&nbsp;/* load last selected country using a cookie, in case page was refreshed&#46;..this also makes sure the state dropdown is populated with the last selected country&#039;s states/provinces */<br />
 var country_data = $(this).val();<br />
 $.cookie(&quot;selectedCountry&quot;, country_data);<br />
 var country_select = $.cookie(&quot;selectedCountry&quot;);<br />
<br />&nbsp;&nbsp; $(&#039;#state&#039;).load(&#039;NameOfYourControllerGoesHere/get_states/&#039;+$(this).val());<br />
 });<br />
});<br />
&lt;/script&gt;<br />
</code></div>
<p>Obviosuly, you need to have countries and states inserted into the appropriate tables in your database for this to work. Here&#8217;s the structure I used for my tables:</p>
<p>&#8212; For countries Table &#8212;<br />
id int(11) auto_increment primary_key,<br />
name varchar(50)</p>
<p>&#8212; For states Table &#8212;<br />
id int(11) auto_increment primary_key,<br />
country_id int(11),<br />
name varchar(50)</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
If I missed something, please send me a comment and I&#8217;ll be happy to fix it. If you have any problems, let me know and I&#8217;ll try to help the best I can.</p>
<p>Thanks for reading</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2011/03/25/populate-state-list-on-country-select-in-cakephp-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Save output of print_r to variable instead of displaying it</title>
		<link>http://www.geekinator.com/2011/01/24/save-output-of-print_r-to-variable-instead-of-displaying-it/</link>
		<comments>http://www.geekinator.com/2011/01/24/save-output-of-print_r-to-variable-instead-of-displaying-it/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 23:36:45 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[print_r]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.geekinator.com/?p=151</guid>
		<description><![CDATA[I found this on someone else&#8217;s site (at http://www.electrictoolbox.com/return-information-from-php-print-r/) and thought I&#8217;d share it here as well. Something I&#8217;ve been wondering about for years and never really figured out how to do, was how to save the output of the print_r command to a variable, instead of actually displaying the contents to the screen. As [...]]]></description>
			<content:encoded><![CDATA[<p>I found this on someone else&#8217;s site (at <a href="http://www.electrictoolbox.com/return-information-from-php-print-r/" target="_blank">http://www.electrictoolbox.com/return-information-from-php-print-r/</a>) and thought I&#8217;d share it here as well.</p>
<p>Something I&#8217;ve been wondering about for years and never really figured out how to do, was how to save the output of the print_r command to a variable, instead of actually displaying the contents to the screen.</p>
<p>As it turns out, it&#8217;s extremely easy to do. You simply need to set the output of print_r to a variable, and then add a 2nd parameter to the print_r function, of true. For instance: $my_var = print_r($my_array,true);</p>
<p>Then, instead of actually displaying the contents of the array, your nicely formatted array output is saved to the variable $my_var, to be used however you wish.</p>
<p>In my case, I was wanting to save the output to a text file, for a project I&#8217;m working on, and then use the data inside the array later on in the project&#8230;instead of dealing with the data right away.</p>
<p>Works great, and thanks to the original author for sharing that useful info.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2011/01/24/save-output-of-print_r-to-variable-instead-of-displaying-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Captcha I&#8217;ve Seen Yet!</title>
		<link>http://www.geekinator.com/2010/08/30/best-captcha-ive-seen-yet/</link>
		<comments>http://www.geekinator.com/2010/08/30/best-captcha-ive-seen-yet/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 21:06:18 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[sexy captcha]]></category>

		<guid isPermaLink="false">http://www.geekinator.com/?p=112</guid>
		<description><![CDATA[I&#8217;m pretty sure I&#8217;m speaking for everyone when I say captcha is usually really annoying and frustrating on most sites. I consider myself to be pretty intelligent and savvy but I have a terrible time trying to figure out what they&#8217;re saying most of the time, unless it&#8217;s a simple math problem or there&#8217;s no [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pretty sure I&#8217;m speaking for everyone when I say <a href="http://en.wikipedia.org/wiki/CAPTCHA" target="_blank">captcha</a> is usually really annoying and frustrating on most sites. I consider myself to be pretty intelligent and savvy but I have a terrible time trying to figure out what they&#8217;re saying most of the time, unless it&#8217;s a simple math problem or there&#8217;s no noise added to the captcha image.</p>
<p>While the simple math problems or basic logic questions work, they still make you type something in, and I&#8217;m a big fan of &#8220;the less steps it involves, the better&#8221;. I&#8217;ve been trying to find something that not only keeps most of the spam bots from filling out my forms but is super easy for visitors to use so that it won&#8217;t scare them away.</p>
<p>Well, I found such a solution a couple of days ago, called SexyCaptcha. You can download it and try it out for yourself at <a href="http://blog.lukeblackamore.com/2009/10/sexy-captcha-new-drag-and-drop-captcha.html" target="_blank">http://blog.lukeblackamore.com/2009/10/sexy-captcha-new-drag-and-drop-captcha.html</a>. What it does is display four simple shapes, and an outline of one of those shapes. All the user has to do is click or drag the appropriate shape into the shape outline, and voila&#8230;the captcha is passed!<br />
<a href="http://www.geekinator.com/wp-content/uploads/2010/08/sexy-captcha.png"><img src="http://www.geekinator.com/wp-content/uploads/2010/08/sexy-captcha.png" alt="sexy captcha" title="sexy-captcha" width="437" height="116" class="alignnone size-full wp-image-116" /></a></p>
<p>How simple and creative is that?!? The only downside that I see is if you want to display it any smaller than 433 pixels wide, you&#8217;re going to have to shrink the images and mess with the css but it&#8217;s not that big a deal. I think I&#8217;ll be using this on my future projects for sure, until I find something better and/or easier, and I don&#8217;t see that happening anytime soon!</p>
<p>It took me a while to adapt it to my <a href="http://cakephp.org" target="_blank">cakephp</a> projects (only because I was missing some typos&#8230;typical lol), but was able to do so and it works perfectly. If you&#8217;re looking for a super easy captcha that still performs the same security as one someone has to type in, then give SexyCaptcha a try. I don&#8217;t think you&#8217;ll be disappointed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2010/08/30/best-captcha-ive-seen-yet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Want to speed up your coding? Give a framework a try!</title>
		<link>http://www.geekinator.com/2010/08/24/want-to-speed-up-your-coding-give-a-framework-a-try/</link>
		<comments>http://www.geekinator.com/2010/08/24/want-to-speed-up-your-coding-give-a-framework-a-try/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 16:28:04 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.geekinator.com/?p=105</guid>
		<description><![CDATA[I&#8217;ve been working with PHP for about 10 years now, and the one problem I&#8217;ve always had was keeping my code organized and how to reuse my code efficiently. Well, a couple of years ago, I ran across some information about using frameworks to help speed up the coding process. I&#8217;m always a big fan [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with PHP for about 10 years now, and the one problem I&#8217;ve always had was keeping my code organized and how to reuse my code efficiently. Well, a couple of years ago, I ran across some information about using frameworks to help speed up the coding process. I&#8217;m always a big fan of making things easier, even if it&#8217;s &#8220;not the way most people would do it&#8221; or &#8220;not the way a professional would do it&#8221;&#8230;forget that, I say whatever gets the job done is what wins!</p>
<p>There are many frameworks to choose from for pretty much any scripting or programming language. Because I mainly code my web apps in PHP, I decided to first try <a href="http://www.codeigniter.com" target="_blank">CodeIgniter</a> because it seemed simple enough. Well, it turned out to be far too simple for me, because I was looking for something that took care of a lot of the heavy lifting for me. I don&#8217;t like reinventing the wheel&#8230;if it&#8217;s already done and it works, why not use it. I&#8217;m not going to go into all the details about the features CodeIgniter offers, but their website has very good documentation if you want to learn about it. Once I tried CodeIgniter and found it to be too limited for my tastes (I&#8217;m not saying it&#8217;s not a good framework, but I would recommend it to someone who really wants to code most of the logic themselves), I decided to give another framework, named <a href="http://www.cakephp.org" target="_blank">CakePHP</a>, a try.</p>
<p>CakePHP turned out to be a huge time saver in most areas for me. Not only does it help me keep my code well organized, because of the <a href="http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller" target="_blank">MVC</a> (model, view, controller) structure, but there are tons of functions included with the release that help with the most common and some advanced features. I&#8217;m still learning the ins and outs of designing an app using the MVC approach, because it&#8217;s very alien to me since I&#8217;ve always been a pretty unorganized coder, but I&#8217;m getting there. With time, I think it may force me to become a better programmer overall.</p>
<p>So, if you&#8217;re like me and are having trouble keeping your code organized or just want something to make building dynamic web apps easier, give a framework a try&#8230;you may just be surprised at how much easier it is to develop your apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2010/08/24/want-to-speed-up-your-coding-give-a-framework-a-try/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clicky Stats &#8211; The Best Web Stats ever!</title>
		<link>http://www.geekinator.com/2010/04/06/clicky-stats-the-best-web-stats-ever/</link>
		<comments>http://www.geekinator.com/2010/04/06/clicky-stats-the-best-web-stats-ever/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 00:17:43 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[clicky]]></category>
		<category><![CDATA[clicky stats]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://www.geekinator.com/?p=91</guid>
		<description><![CDATA[My company owns a lot of domain names, and we have created various sites to host on those domains over the years. The one problem we&#8217;ve always had was trying to figure out the best web stats software to use on all of these sites. I&#8217;ve tried Google Analytics, which is ok but very limiting [...]]]></description>
			<content:encoded><![CDATA[<p>My company owns a lot of domain names, and we have created various sites to host on those domains over the years. The one problem we&#8217;ve always had was trying to figure out the best web stats software to use on all of these sites. I&#8217;ve tried Google Analytics, which is ok but very limiting in my opinion, as far as being able to back them up, search, etc. I&#8217;ve also tried awstats and webalizer, but found them really technical. Yes, I said &#8220;technical&#8221;&#8230;even the geekinator gets confused with technology sometimes : ). I thought I had hit the motherload when I found <a href="http://piwik.org/" target="_blank">Piwik Stats</a>, which is a free Open Source web analytics script. It has some really great features, and is really simple to use, but unfortunately for me, it doesn&#8217;t seem to work that great when you&#8217;re trying to track a ton of websites on a single server. The processing script takes hours and hours to process the traffic on all my sites, and was kind of glitchy when dealing with that amount of data. I would get strange, random, results. I&#8217;m sure Piwik is a great solution for someone who only needs to track up to a few sites, but that wasn&#8217;t me. I decided I really just needed a service that hosted the tracking software, and used their server for processing the data.</p>
<p>I had almost given up and just put Google Analytics on each site, so at least I have something tracking visitors&#8230;.something&#8217;s always better than nothing. Then, one day, I started to get frustrated with having to create a ton of accounts, under a single google login, in order: to track the hundreds of domains that I own. I though to myself &#8220;There has to be a better way, without me having to create my own script. I really don&#8217;t want to reinvent the wheel if I absolutely don&#8217;t have to&#8221;. A few hours of searching, finally brought <a title="Clicky Web Stats" href="http://getclicky.com/158114" target="_blank">Clicky Stats</a> to my attention!</p>
<p>Clicky Stats is available at <a href="http://getclicky.com/158114" target="_blank">http://getclicky.com</a>, and is HANDS DOWN the absolute best web site visitor tracking service/script I have ever had the pleasure of using! You may be asking yourself, &#8220;Well, ok, what does Clicky do?&#8221;. My response to you would be, What doesn&#8217;t Clicky do?!? This software is amazing, and lets you have control of your stats, instead of leaving you wondering how you&#8217;ll be able to use the stats.</p>
<p>First off, the creator of Clicky Stats, wrote a really simple and powerful API to allow anyone to access their stats in any format they want. Yes, there are other web stats packages out there that offer an API as well, and that&#8217;s all fine and dandy, except I&#8217;ve never used one that&#8217;s so easy to use. Second, Clicky gives you every piece of data under the sun about the user. Lets run down the feature list, if I may (Get ready for this&#8230;it&#8217;s a huge list : ) ):</p>
<ul>
<li>Customizable dashboard that displays data about the current day</li>
<li>List of visitors for the requested date period</li>
<li>How many actions each user took while on your site (i.e. how many links they clicked/pages they viewed)</li>
<li>How long each visitor spent on the site</li>
<li>The referring site/search engine, plus any search query they typed in to find your site</li>
<li>Each visitor&#8217;s IP address, Hostname, ISP, Language, Location, Operating System, Web Browser, Screen Resolution, and whether or not they have Javascript enabled in their browser.</li>
<li>Action log of each individual visitor, which tells you in order which pages they visited on your site</li>
<li>List of the most active visitors on your site, along with their IP and how many visits they have had in a given date period</li>
<li>Traffic sources, broken up by searches, direct/bookmark, links, email, and social media</li>
<li>Web browsers used, broken up by browser version</li>
<li>Operating Systems used, broken up by operating system version</li>
<li>Mobile devices used, broken up by device version (i.e. iPhone, iPod touch, Blackberry, etc)</li>
<li>Screen Resolutions used</li>
<li>List of visitors&#8217; Country</li>
<li>List of visitors&#8217; Region (i.e. State or Province)</li>
<li>List of visitors&#8217; City</li>
<li>List of visitors&#8217; Language</li>
<li>List of visitors&#8217; Hostname and Organization (i.e. their ISP)</li>
<li>Global map of all the visitors for a given date period</li>
<li>Global map of recent visitors</li>
<li>List of all the pages visited, along with a hit count (I&#8217;d like to see a unique visitor count per page, but I can&#8217;t have it all I guess : ) )</li>
<li>List of all entrance pages, along with hit count</li>
<li>List of all exit pages, along with hit count</li>
<li>List of all downloaded files, along with hit count</li>
<li>List of all clicks (not sure exactly what this does)</li>
<li>List of incoming links (links that people clicked to bring them to your site. i.e. a link in forum post for instance. This has the exact url of the page the link was on)</li>
<li>List of domains that brought visitors to your site</li>
<li>List of outgoing links (external links that may exist on your site)</li>
<li>List of links that recently brought visitors to your site</li>
<li>Unique List of links that recently brought visitors to your site</li>
<li>List of short urls (i.e. clicky has a short url service, called clicky.me, which allows you to create a short link, that redirects to your page that has a long url. Tinyurl.com does this as well)</li>
<li>List of searches (through search engines) that brought visitors to your site, along with a visitor count</li>
<li>List of keywords typed in during those searches (basically, it splits the search phrase into individual words, and then gives you a visitor count per word)</li>
<li>List of search engines, along with their subdomains, that brought visitors to your site, including a visitor count from each domain.</li>
<li>List of recent searches that brought visitors to your site</li>
<li>Unique list of recent searches that brought visitors to your site</li>
<li>You can create goals for marketing that you can then track, to see if the marketing is working or not.</li>
<li>You can track advertisement campaigns as well. I&#8217;m not quite sure how you do that, since I&#8217;ve never played with that feature.</li>
<li>You can track traffic through your Twitter feed, if you like. Again, I&#8217;m not quite sure how that works, because I haven&#8217;t played with it.</li>
<li>My absolute favorite feature of Clicky, is the real time Spy feature. This thing is so cool&#8230;what it does, is show you an ajaxified (I&#8217;m guessing) map of real time traffic on your site! It shows a pin where the visitor is in the world, and what they&#8217;re searching for to find your site, along with what page they&#8217;re currently on or have been on. You can literally spend hours watching people mess around on your site&#8230;it&#8217;s really cool.</li>
<li>Another really useful feature, is the ability to setup scheduled email reports, that send you requested data from your stats, by day, week, or month.</li>
<li>You can also output selected data in CSV or XML format, which is really handy.</li>
<li>You can also track your feedburner account, if you have one.</li>
<li>Another feature that I really like is the ability to block your own IP address, so it doesn&#8217;t count your personal visits.</li>
<li>Last, but not least, are the widgets. There are multiple widgets that allow you to display certain traffic data on your site, if you would like to do so.</li>
</ul>
<p>There you have it&#8230;whewwww, that was a lot of typing! Anyway, I hope you get my point. Clicky is the most useful tracking software I have ever found. If you know of something better or similar, please let me know.</p>
<p>I have to say, the pricing is fantastic as well. I won&#8217;t say what my monthly fee is, but I can tell you it&#8217;s way more than fair. Here&#8217;s a link to their standard <a href="http://getclicky.com/help/pricing" target="_blank">pricing page</a>. I was given a custom price, because I have a lot more domains than they show on the price page.</p>
<p>If you&#8217;d like to check out Clicky, and signup for an account, <a href="http://getclicky.com/158114" target="_blank">click here</a>. You can even try it out with a FREE account, which limits the features and amount of data, etc, but you can get a great idea of what Clicky has to offer your site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2010/04/06/clicky-stats-the-best-web-stats-ever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speed up your PHP pages with Gzip!</title>
		<link>http://www.geekinator.com/2010/02/06/speed-up-your-php-pages-with-gzip/</link>
		<comments>http://www.geekinator.com/2010/02/06/speed-up-your-php-pages-with-gzip/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 00:51:52 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://geekinator.com/?p=13</guid>
		<description><![CDATA[I can&#8217;t believe I haven&#8217;t learned about this little trick until recently, but I&#8217;m sure glad I learned it. A lot of you may already know this, but there&#8217;s a simple little tag you can add to the top of your PHP pages that will speed up the transfer of your site significantly, and on [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t believe I haven&#8217;t learned about this little trick until recently, but I&#8217;m sure glad I learned it. A lot of you may already know this, but there&#8217;s a simple little tag you can add to the top of your PHP pages that will speed up the transfer of your site significantly, and on the fly. Don&#8217;t ask me how it works exactly, but I can tell you that it uses gzip compression (from what I have read) to automatically compress the output of your pages before it&#8217;s sent to the visitors&#8217; browser.</p>
<p>All you have to do is add the following line to the top of any php page you want to compress: ob_start(&#8220;ob_gzhandler&#8221;)</p>
<p>For example, if your page looks like this:</p>
<p>&lt;?php</p>
<p><!--p<--></p>
<p>echo &#8220;This is my page&#8221;;</p>
<p>?&gt;</p>
<p>Your finished, compressed, file would look like:</p>
<p>&lt;?php</p>
<p><!--p<--></p>
<p>ob_start(&#8220;ob_gzhandler&#8221;)</p>
<p>echo &#8220;This is my page&#8221;;</p>
<p>?&gt;</p>
<p>I also read somewhere (and if I can find the post again, I&#8217;ll update this post to give that person credit), that you should add an if statement around that line to make sure the visitor&#8217;s browser supports gzip. I&#8217;m not sure if it&#8217;s absolutely necessary these days, but I added it just to be safe. So, the line I add to my files is:</p>
<p>if(!ob_start(&#8220;ob_gzhandler&#8221;)){ ob_start(); }</p>
<p>Now, I&#8217;m not an expert at compression or anything, but it works and that&#8217;s good enough for me until I find out there&#8217;s some sort of problem with doing it that way. By the way, you can test your page to see if the gzip is actually working or not by going to <a href="http://www.whatsmyip.org/http_compression/" target="_blank">http://www.whatsmyip.org/http_compression/</a>. Another thing I should mention is your server has to have the zlib php library installed and active. You can read more about that at <a href="http://php.net/manual/en/book.zlib.php" target="_blank">http://php.net/manual/en/book.zlib.php</a></p>
<p>On most of my large files, I was able to compress the output by as much as 90% in some cases. The larger your output is, the higher compression you&#8217;ll achieve. I&#8217;m not sure if this is the &#8220;correct&#8221; way of adding the compression to wordpress, but all I did was add the line to the header.php file in my template. I tested the site and it&#8217;s gzipped!</p>
<p>Of course, there&#8217;s also the added bonus (more likely the reason you&#8217;d want to do this for a really large site) of saving on your bandwidth usage. For really large sites, the cost of bandwith can be pretty large, but I think I like the idea of it speeding up the site for my visitors even more than the bandwith savings.</p>
<p>I hope that helped everyone as much as it helped me. Thanks to the guys over at WhatsMyIp.org for the information.</p>
<p><strong>EDIT: </strong>I didn&#8217;t know this until a few days after posting the php code, but you can also gzip an entire site  using .htaccess (at least the html output of the site anyway). All you have to do is add these 2 lines to your .htaccess file:</p>
<p>php_value output_buffering On<br />
php_value output_handler ob_gzhandler</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2010/02/06/speed-up-your-php-pages-with-gzip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working on a new classified ad system</title>
		<link>http://www.geekinator.com/2010/02/05/working-on-a-new-classified-ad-system/</link>
		<comments>http://www.geekinator.com/2010/02/05/working-on-a-new-classified-ad-system/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 23:30:50 +0000</pubDate>
		<dc:creator>geekinator</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[classified ads]]></category>

		<guid isPermaLink="false">http://geekinator.com/?p=4</guid>
		<description><![CDATA[I&#8217;ve always subscribed to the &#8220;don&#8217;t reinvent the wheel&#8221; theory in everything I do, especially when trying to develop software. However, sometimes the wheel turns out to be a little lopsided. Over the past few years, I&#8217;ve used a couple of different classified ad systems to run my fairly successful RV Classified Ads website, that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always subscribed to the &#8220;don&#8217;t reinvent the wheel&#8221; theory in everything I do, especially when trying to develop software. However, sometimes the wheel turns out to be a little lopsided.</p>
<p>Over the past few years, I&#8217;ve used a couple of different classified ad systems to run my fairly successful RV Classified Ads website, that my dad and I own, called <a href="http://www.rvclearinghouse.com" target="_blank">www.RVClearingHouse.com</a>. The first system I used was custom built and we paid $5,000 for it in 2000 and it worked really well. Well, long story short, we had a problem with the company that built the software and they turned off the site.</p>
<p>I then built my own system with PHP and MySQL, before I really knew what I was doing. It was simple and worked OK, but still wasn&#8217;t scalable. My company owns and operates over 2,300 small websites, so by the time I needed some new software to run my classified site, I figured I should just buy a turnkey system instead of taking the time to write my own. I did a little research and found that most people recommended the GeoClassifieds system, and I bought the $100 version first to try it out, but decided it was too limited and upgraded to the $700 version on a gamble. 3 years later, I&#8217;ve had nothing but problems with it and am now taking the time to develop my own, that will hopefully work much better than my first attempt.</p>
<p>I&#8217;ll admit that I&#8217;m pretty lazy when it comes to programming, so I looked at some various frameworks and decided that <a href="http://cakephp.org" target="_blank">cakePHP</a> worked the best for me. Now, some of you out there may agree or disagree with me, and that&#8217;s perfectly fine, but for me cake seems to do the job. I figure I have a couple more months of fine tuning my code before I migrate my existing ads (roughly 9,000) into my new system.</p>
<p>When I started brainstorming, I decided it would be a good idea to be able to add any custom field that I wanted to, based on a category. For instance, if I wanted an Items for Sale category and a For Trade category, the for sale category would need a price field, whereas the trade category would most likely not. I&#8217;m not sure if the method I chose to go about setting up custom fields in the database was the &#8220;correct&#8221; way to accomplish it, but it seems to work fine. Until I come up with a reason why it&#8217;s a horrible way, then I&#8217;ll stick with it.</p>
<p>Anyway, that&#8217;s about it for my first post. It doesn&#8217;t give you much useful information I guess, but at least you can get a sense of what another wannabe programmer is up to in the world. I&#8217;ll be back with more amazing adventures of <em><strong>The Geekinator</strong></em>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekinator.com/2010/02/05/working-on-a-new-classified-ad-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

