<?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>this.rand() &#187; scripts</title>
	<atom:link href="http://www.thisrand.com/tag/scripts/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thisrand.com</link>
	<description>the life of Ryan Meinzer and Jessica Meinzer</description>
	<lastBuildDate>Mon, 19 Sep 2011 01:41:44 +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>Tweaking Jquery AutoSuggest</title>
		<link>http://www.thisrand.com/2011/01/tweaking-jquery-autosuggest</link>
		<comments>http://www.thisrand.com/2011/01/tweaking-jquery-autosuggest#comments</comments>
		<pubDate>Mon, 31 Jan 2011 17:19:52 +0000</pubDate>
		<dc:creator>Xnuiem</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[geekdom]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.thisrand.com/?p=1521</guid>
		<description><![CDATA[Tweaking the Drew Wilson Jquery autosuggest script to display a full list on double click without typing any input.]]></description>
			<content:encoded><![CDATA[<p>I have been using the <a target="_blank" class="zem_slink" title="JQuery" rel="homepage" href="http://jquery.com/">JQuery library</a> for a long time now, and am still amazed at what people get it to do.  One feature that the base libaray was really lacking was a good <a target="_blank" class="zem_slink" title="Incremental search" rel="wikipedia" href="http://en.wikipedia.org/wiki/Incremental_search">Autosuggest</a> for a text input.  It needed to be <a target="_blank" class="zem_slink" title="Ajax (programming)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Ajax_%28programming%29">AJAX</a> driven, and understand having multiple values.</p>
<p>I found a great example of what I wanted at <a target="_blank" href="http://code.drewwilson.com/entry/autosuggest-jquery-plugin" target="_blank">Drew Wilson&#8217;s blog</a>, complete with almost all the features I needed.</p>
<p>One thing his script is really lacking is a good way to show ALL the results.  We have a huge category list, and want to let someone browse them all.  In the base script, this isn&#8217;t going to work, since there isnt a way to make the look up fire off without input.  I didnt want my users to have to enter in, one by one, each letter of the alphabet looking for what they wanted, so I settled on using a double click event to force the display of the entire list.</p>
<p>And here is how to make that happen:</p>
<p>In the js file (jquery.autoSuggest.js) you will need to make some changes.</p>
<p>~line 149 add:</p>
<pre> }).dblclick(<a target="_blank" class="zem_slink" title="Function (mathematics)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Function_%28mathematics%29">function</a>(){</pre>
<pre> if (timeout){ clearTimeout(timeout); }</pre>
<pre> timeout = setTimeout(function(){ keyChange(); }, opts.keyDelay);</pre>
<p>so it will look like:</p>
<pre> }).blur(function(){</pre>
<pre> if($(this).val() == "" &amp;&amp; values_input.val() == "" &amp;&amp; prefill_value == ""){</pre>
<pre> $(this).val(opts.startText);</pre>
<pre> } else if(input_focus){</pre>
<pre> $("li.as-selection-item", selections_holder).addClass("blur").removeClass("selected");</pre>
<pre> results_holder.hide();</pre>
<pre> }</pre>
<pre> }).dblclick(function(){</pre>
<pre> if (timeout){ clearTimeout(timeout); }</pre>
<pre> timeout = setTimeout(function(){ keyChange(); }, opts.keyDelay);</pre>
<pre> }).keydown(function(e) {</pre>
<p>This will pull up a list on <a target="_blank" class="zem_slink" title="Double-click" rel="wikipedia" href="http://en.wikipedia.org/wiki/Double-click">double click</a>.  You can change dlbclick to just click for a <a target="_blank" class="zem_slink" title="Point-and-click" rel="wikipedia" href="http://en.wikipedia.org/wiki/Point-and-click">single click</a> response instead.</p>
<p>~line 226 comment out the lines:</p>
<pre>if( lastKeyPressCode == 46 || (lastKeyPressCode &gt; 8 &amp;&amp; lastKeyPressCode &lt; 32) ){ return results_holder.hide(); }</pre>
<p>and</p>
<pre>if (string == prev) return;</pre>
<p>and</p>
<pre>if (string.length &gt;= opts.minChars) {</pre>
<p>and then on ~line 252 comment out</p>
<pre> } else {</pre>
<pre> selections_holder.removeClass("loading");</pre>
<pre> results_holder.hide();</pre>
<pre> }</pre>
<p>You will also want to turn the option &#8220;resultsHighlight&#8221; false, when you create the instance.</p>
<p>Now, on double click it will present a full list of options.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a target="_blank" href="http://designshack.co.uk/articles/javascript/weekly-freebies-10-brilliant-jquery-plugins">Weekly Freebies: 10 Brilliant jQuery Plugins</a> (designshack.co.uk)</li>
<li class="zemanta-article-ul-li"><a target="_blank" href="http://www.devcurry.com/2010/11/jquery-144-fadetoggle-function.html">jQuery 1.4.4 fadeToggle() function</a> (devcurry.com)</li>
<li class="zemanta-article-ul-li"><a target="_blank" href="http://addyosmani.com/blog/jquery-roundrr/">jQuery Roundrr &#8211; How To Create Awesome Circular Image Galleries With jQuery &amp; CSS</a> (addyosmani.com)</li>
<li class="zemanta-article-ul-li"><a target="_blank" href="http://www.devcurry.com/2010/10/use-jquery-to-scroll-to-bottom-or-top.html">Use jQuery to Scroll to Bottom or Top of a Page</a> (devcurry.com)</li>
<li class="zemanta-article-ul-li"><a target="_blank" href="http://renesd.blogspot.com/2011/01/jquery-15-promises-better-future.html">JQuery 1.5 promises a better future.</a> (renesd.blogspot.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a target="_blank" class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=4e0fe6cc-4494-4d0c-a7ab-aa75277a202e" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.thisrand.com/2011/01/tweaking-jquery-autosuggest/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Types of Programming Bugs</title>
		<link>http://www.thisrand.com/2010/09/types-of-programming-bugs</link>
		<comments>http://www.thisrand.com/2010/09/types-of-programming-bugs#comments</comments>
		<pubDate>Thu, 23 Sep 2010 17:15:09 +0000</pubDate>
		<dc:creator>Xnuiem</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[thoughts]]></category>
		<category><![CDATA[clients]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.thisrand.com/?p=1041</guid>
		<description><![CDATA[In a recent project I have been working on, I took over another&#8217;s code base, based in Drupal, and have been working to both fix issues and add functionality.  It...]]></description>
			<content:encoded><![CDATA[<p>In a recent project I have been working on, I took over another&#8217;s code base, based in <a target="_blank" class="zem_slink" title="Drupal" rel="homepage" href="http://www.drupal.org">Drupal</a>, and have been working to both fix issues and add functionality.  It has been a lot of fun learning Drupal, and working with this interesting application.  And finding different types of bugs.  If you are a programmer, you know there are bugs that are different and behave oddly.   Here are some types of <a target="_blank" class="zem_slink" title="Software bug" rel="wikipedia" href="http://en.wikipedia.org/wiki/Software_bug">programming bugs</a> I have come across recently.</p>
<p><strong><span class="zem_slink">Heisenbug</span></strong><br />
Named for the <a target="_blank" href="http://en.wikipedia.org/wiki/Uncertainty_principle" target="_blank"><em>Heisenberg uncertainty principle</em></a>, this type of bug is only appears when you aren&#8217;t looking.  You know the kind, the kind you swear you can&#8217;t replicate, but yet, the users day after day report them happening.  If you try to measure this type of bug, you will inevitably alter your results.  They are the worst to track down, because a lot of the time you end up making changes just to hope they go away, even though you still aren&#8217;t sure exactly what caused them.</p>
<p><strong>Keyser Söze Bug</strong><br />
These actually arent even bugs, but they make you think they are, and are a complete pain in the neck.  Basically, it is a &#8220;bug&#8221; that is causing a huge problem for you, but as you learn, and dig and dig, you figure out it isnt a bug, just a &#8220;feature&#8221;.  It may be stupid, illogical, or incorrect, but the code itself is working just as design and written.  So, in essence, it isnt a bug, only made you think it was.</p>
<p><strong>WTF Bug</strong><br />
This is one of those that you swear up and down you have fixed, several times, yet is still there.  The most common one of these is when a customer&#8217;s ISP or internal firewall have cached old versions, so the damn thing is still cropping up on you, but you know it isn&#8217;t there anymore.  Another time these happen is when you change one part of the code, only to figure out that those methods were depreciated 8 versions ago, and now all that logic is somewhere else.  Yes you changed it, yes you committed it, but the bug is still there.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a target="_blank" href="http://drupal.org/drupal-6.19">Drupal 6.18, 6.19 and 5.23 released</a> (drupal.org)</li>
<li class="zemanta-article-ul-li"><a target="_blank" href="http://www.omgubuntu.co.uk/2010/09/how-scalable-is-open-source/">How scalable is open source?</a> (omgubuntu.co.uk)</li>
<li class="zemanta-article-ul-li"><a target="_blank" href="http://programmers.stackexchange.com/q/1785/30">What should every programmer know about programming?</a> (programmers.stackexchange.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a target="_blank" class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=0f72625f-9c36-446e-988d-3e6ae175f2ed" alt="Enhanced by Zemanta" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.thisrand.com%2F2010%2F09%2Ftypes-of-programming-bugs&amp;title=Types%20of%20Programming%20Bugs" id="wpa2a_2"><img src="http://www.thisrand.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.thisrand.com/2010/09/types-of-programming-bugs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix WP ECommerce</title>
		<link>http://www.thisrand.com/2010/08/how-to-fix-wp-ecommerce</link>
		<comments>http://www.thisrand.com/2010/08/how-to-fix-wp-ecommerce#comments</comments>
		<pubDate>Mon, 30 Aug 2010 22:57:50 +0000</pubDate>
		<dc:creator>Xnuiem</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[writings]]></category>
		<category><![CDATA[cute]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[geekdom]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[reviews]]></category>
		<category><![CDATA[Royalty Interest]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.thisrand.com/?p=830</guid>
		<description><![CDATA[On front end pages with no ecommerce functionality, this plugin adds over 220+ database queries.  The more I messed with the code trying to make it behave, the more I...]]></description>
			<content:encoded><![CDATA[<p>On front end pages with no ecommerce functionality, this plugin adds over 220+ database queries.  The more I messed with the code trying to make it behave, the more I understood just how horribly written this plugin is.</p>
<p>Now, as someone that has been doing development long enough to know, there are times that code just gets away from the development team and becomes a mess unto itself.  It happens, especially in the OSS world where code reviews are few if ever.  But, as I read the forums for this thing, the developers are just fooling themselves thinking the code is in good shape.</p>
<p>Here are a few basic suggestions:<br />
1) Check to see if the page needs to execute the plugin.  If it doesnt, dont do it.  There is no reason to increase the number of queries by an order of magantuide when I am on a page that has no WP Ecommerce functionality.<br />
2) Clean up the queries.  For example:<br />
SELECT `id` FROM `wp_product_list` WHERE `active` IN(&#8217;1&#8242;)<br />
should be<br />
SELECT `id` FROM `wp_product_list` WHERE `active` = 1<br />
It is more effiecent.</p>
<p>3) Index the tables!  The query above doesnt use an index.  That is right folks, the field &#8220;active&#8221; in product_list is not indexed.  This is easy and simple.</p>
<p>4) Use arrays or some other data structure for complex data.  Dont use the same basic query over and over again.  Example:</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.thisrand.com%2F2010%2F08%2Fhow-to-fix-wp-ecommerce&amp;title=How%20to%20fix%20WP%20ECommerce" id="wpa2a_4"><img src="http://www.thisrand.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.thisrand.com/2010/08/how-to-fix-wp-ecommerce/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin over SSL</title>
		<link>http://www.thisrand.com/2009/10/phpmyadmin-over-ssl-2</link>
		<comments>http://www.thisrand.com/2009/10/phpmyadmin-over-ssl-2#comments</comments>
		<pubDate>Sun, 04 Oct 2009 18:53:06 +0000</pubDate>
		<dc:creator>Xnuiem</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://206</guid>
		<description><![CDATA[I get asked this question a lot: &#8220;How can I force phpMyAdmin to run over https &#8216;SSL&#8217;?&#8221; It is basically an issue to deal with security. Since phpMyAdmin deals with...]]></description>
			<content:encoded><![CDATA[<p>I get asked this question a lot: &#8220;How can I force phpMyAdmin to run over https &#8216;SSL&#8217;?&#8221;  It is basically an issue to deal with security.  Since <a target="_blank" href="http://www.phpmyadmin.net" target="_blank">phpMyAdmin</a> deals with directly accessing your database, it only makes sense you want to make it as secure as you can.  While running over SSL &#8216;HTTPS&#8217; is not the total solution, it does help.  So, here is how to make it run over SSL.</p>
<p><span id="more-876"></span></p>
<p>Assuming you already have SSL installed and configured correctly in your webserver for whatever directory phpMyAdmin is in, open up the index.php file, and at the very top, just after the comments end, but before the includes&#8221;, add these few lines:</p>
<pre>if '$_SERVER["SERVER_PORT"] != 443'{
$head = "Location: https://" . $_SERVER["HTTP_HOST"] .  $_SERVER["REQUEST_URI"];
header'$head';
exit;
}</pre>
<p>That&#8217;s it.  It will force your page loads to go through HTTPS.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.thisrand.com%2F2009%2F10%2Fphpmyadmin-over-ssl-2&amp;title=phpMyAdmin%20over%20SSL" id="wpa2a_6"><img src="http://www.thisrand.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.thisrand.com/2009/10/phpmyadmin-over-ssl-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin over SSL</title>
		<link>http://www.thisrand.com/2008/02/phpmyadmin-over-ssl</link>
		<comments>http://www.thisrand.com/2008/02/phpmyadmin-over-ssl#comments</comments>
		<pubDate>Thu, 01 Jan 1970 01:33:28 +0000</pubDate>
		<dc:creator>Xnuiem</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://206</guid>
		<description><![CDATA[I get asked this question a lot: &#8220;How can I force phpMyAdmin to run over https &#8216;SSL&#8217;?&#8221; It is basically an issue to deal with security. Since phpMyAdmin deals with...]]></description>
			<content:encoded><![CDATA[<p>I get asked this question a lot: &#8220;How can I force phpMyAdmin to run over https &#8216;SSL&#8217;?&#8221;  It is basically an issue to deal with security.  Since <a target="_blank" href="http://www.phpmyadmin.net" target="_blank">phpMyAdmin</a> deals with directly accessing your database, it only makes sense you want to make it as secure as you can.  While running over SSL &#8216;HTTPS&#8217; is not the total solution, it does help.  So, here is how to make it run over SSL.</p>
<p><span id="more-23"></span></p>
<p>Assuming you already have SSL installed and configured correctly in your webserver for whatever directory phpMyAdmin is in, open up the index.php file, and at the very top, just after the comments end, but before the includes&#8221;, add these few lines:</p>
<pre>if '$_SERVER["SERVER_PORT"] != 443'{
$head = "Location: https://" . $_SERVER["HTTP_HOST"] .  $_SERVER["REQUEST_URI"];
header'$head';
exit;
}</pre>
<p>That&#8217;s it.  It will force your page loads to go through HTTPS.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.thisrand.com%2F2008%2F02%2Fphpmyadmin-over-ssl&amp;title=phpMyAdmin%20over%20SSL" id="wpa2a_8"><img src="http://www.thisrand.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.thisrand.com/2008/02/phpmyadmin-over-ssl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

