<?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>damonparker.org &#187; Technical</title>
	<atom:link href="http://damonparker.org/blog/category/technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://damonparker.org</link>
	<description>code / ecommerce / life</description>
	<lastBuildDate>Thu, 24 Feb 2011 21:29:16 +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>MySQL Error Function Wrapper for PHP</title>
		<link>http://damonparker.org/blog/2011/02/07/mysql-error-function-wrapper-for-php/</link>
		<comments>http://damonparker.org/blog/2011/02/07/mysql-error-function-wrapper-for-php/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 00:01:32 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://damonparker.org/?p=634</guid>
		<description><![CDATA[I was recently asked to supply some development and debugging functionality to a web application built for a client. The following function can be configured to popup for only your IP, and gives an error message containing the SQL, line number and file for easy debugging of the error. I like this function over my [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I was recently asked to supply some development and debugging functionality to a web application built for a client.  The following function can be configured to popup for only your IP, and gives an error message containing the SQL, line number and file for easy debugging of the error.</p>
<p>I like this function over my current hobbled together debug kit because the display is positioned top center of the page via CSS no matter where the error occurs.  Plus it includes a hide button to hide the majority of the error output and remove button to remove the error display altogether.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> mysql_error_wrapper<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$q</span>, <span style="color: #0000ff;">$sql</span>=<span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$line</span>=<span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$file</span>=<span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'REMOTE_ADDR'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff0000;">'YOUR LOCAL IP'</span><span style="color: #66cc66;">&#41;</span>&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;&gt;&lt;!--<br />
function showhide(d) {<br />
&nbsp; &nbsp; if(document.getElementById(d).style.display == &quot;none&quot;) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(d).style.display = &quot;block&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById('shde').innerHTML = &quot;hide&quot;;<br />
&nbsp; &nbsp; } &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(d).style.display = &quot;none&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById('shde').innerHTML = &quot;show&quot;; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
}<br />
<br />
function remove() &nbsp; {<br />
&nbsp; &nbsp; document.getElementById('errorblock').style.display = &quot;none&quot;;<br />
}<br />
//--&gt;&lt;/script&gt;<br />
<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;div id=&quot;errorblock&quot; style=&quot;display:block;position:absolute;top:10px;left:10%;width:80%;background:#efefef;text-align:left;border:1px solid #CD0000;padding:10px;&quot;&gt;'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;a href=&quot;#&quot; onclick=&quot;showhide(<span style="color: #000099; font-weight: bold;">\'</span>sqlerror<span style="color: #000099; font-weight: bold;">\'</span>)&quot;&gt;&lt;span id=&quot;shde&quot;&gt;hide&lt;/span&gt;&lt;/a&gt; - &lt;a href=&quot;#&quot; onclick=&quot;remove();&quot;&gt;remove&lt;/a&gt;'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;h3 style=&quot;color:#CD0000;&quot;&gt;MySQL error: '</span>.<a href="http://www.php.net/mysql_errno"><span style="color: #000066;">mysql_errno</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">' &lt;small style=&quot;font-weight:normal;&quot;&gt;Line: #'</span>.<span style="color: #0000ff;">$line</span>.<span style="color: #ff0000;">' '</span>.<a href="http://www.php.net/basename"><span style="color: #000066;">basename</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'&lt;/small&gt;&lt;/h3&gt;'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;pre id=&quot;sqlerror&quot; style=&quot;height:250px;overflow:auto;padding:10px;&quot;&gt;'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/wordwrap"><span style="color: #000066;">wordwrap</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$sql</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>&nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;h4&gt;SQL&lt;/h4&gt;'</span>.<a href="http://www.php.net/wordwrap"><span style="color: #000066;">wordwrap</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$sql</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$line</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;h4&gt;Line&lt;/h4&gt;'</span>.<span style="color: #0000ff;">$line</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;h4&gt;File&lt;/h4&gt;'</span>.<span style="color: #0000ff;">$file</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;/pre&gt;'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;/div&gt;'</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Usage example:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$sql</span> = <span style="color: #ff0000;">&quot;YOUR SQL STATEMENT&quot;</span>;<br />
&nbsp; &nbsp; <span style="color: #0000ff;">$q</span> = <a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$sql</span>, <span style="color: #0000ff;">$db</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #0000ff;">$q</span><span style="color: #66cc66;">&#41;</span> mysql_error_wrapper<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$q</span>, <span style="color: #0000ff;">$sql</span>, <span style="color: #000000; font-weight: bold;">__LINE__</span>, <span style="color: #000000; font-weight: bold;">__FILE__</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=634" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=634&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2011/02/07/mysql-error-function-wrapper-for-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Download a Remote File Using PHP and cURL</title>
		<link>http://damonparker.org/blog/2011/02/03/download-remote-file-using-php-and-curl/</link>
		<comments>http://damonparker.org/blog/2011/02/03/download-remote-file-using-php-and-curl/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 17:02:51 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[cURL]]></category>

		<guid isPermaLink="false">http://damonparker.org/?p=619</guid>
		<description><![CDATA[Some years back, I posted a function to download a remote file with PHP. The function was useful when cURL and other URL/remote file functions had been disabled for security reasons. At the time, cURL on PHP was relatively new and many hosting setups didn&#8217;t include the cURL PHP module. Support for PHP-cURL is pretty [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Some years back, I posted a function to <a href="http://damonparker.org/blog/2005/09/29/download-a-remote-file-using-php/">download a remote file with PHP</a>.  The function was useful when <a href="http://curl.haxx.se/">cURL</a> and other URL/remote file functions had been disabled for security reasons.  At the time, cURL on PHP was relatively new and many hosting setups didn&#8217;t include the cURL PHP module.  </p>
<p>Support for <a href="http://php.net/manual/en/book.curl.php">PHP-cURL</a> is pretty standard now, so I thought I&#8217;d update the the function to use cURL now.  In addition, the function no longer returns a buffer containing the file data which can cause memory issues in PHP when dealing with large files.  Pass this updated function a remote URL and local file path and it will download the file and save it to the local path.</p>
<p>This function is useful to retrieve remote images, download HTML pages and download any remote files.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> http_get_file<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$remote_url</span>, <span style="color: #0000ff;">$local_file</span><span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$fp</span> = <a href="http://www.php.net/fopen"><span style="color: #000066;">fopen</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$local_file</span>, <span style="color: #ff0000;">'w'</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cp</span> = curl_init<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$remote_url</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cp</span>, CURLOPT_FILE, <span style="color: #0000ff;">$fp</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$buffer</span> = curl_exec<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cp</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_close<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cp</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span style="color: #000066;">fclose</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$fp</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=619" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=619&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2011/02/03/download-remote-file-using-php-and-curl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hardcode WordPress Site URL</title>
		<link>http://damonparker.org/blog/2011/01/11/hardcode-wordpress-site-url/</link>
		<comments>http://damonparker.org/blog/2011/01/11/hardcode-wordpress-site-url/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 20:13:16 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://damonparker.org/?p=617</guid>
		<description><![CDATA[I&#8217;m working on a project for mobile devices and need to be able to setup the same WordPress install on both the .mobi and the .com domain. This snippet lets you hardcode the URL and home configurables in wp_config.php. We use one setup of configurables for the .mobi side and another set for the .com. [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;m working on a project for mobile devices and need to be able to setup the same WordPress install on both the .mobi and the .com domain.  This snippet lets you hardcode the URL and home configurables in wp_config.php.  We use one setup of configurables for the .mobi side and another set for the .com.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/define"><span style="color: #000066;">define</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'WP_HOME'</span>,<span style="color: #ff0000;">'http://example.com'</span><span style="color: #66cc66;">&#41;</span>;<br />
<a href="http://www.php.net/define"><span style="color: #000066;">define</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'WP_SITEURL'</span>,<span style="color: #ff0000;">'http://example.com'</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p>Thanks to the <a href="http://codex.wordpress.org/Changing_The_Site_URL">WordPress Codex</a>.</p>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=617" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=617&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2011/01/11/hardcode-wordpress-site-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Image Caption</title>
		<link>http://damonparker.org/blog/2010/11/10/html-image-caption/</link>
		<comments>http://damonparker.org/blog/2010/11/10/html-image-caption/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 04:53:09 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://damonparker.org/?p=535</guid>
		<description><![CDATA[&#60;div id=&#34;image-caption&#34;&#62;&#60;img style=&#34;border: 1px solid black; float: right; margin: 0 0 10px 10px;&#34; src=&#34;/images/imagename.jpg&#34; border=&#34;0&#34; alt=&#34;&#34; width=&#34;175&#34; height=&#34;132&#34; /&#62; &#60;p class=&#34;caption&#34;&#62;HTML Image Caption&#60;/p&#62; &#60;/div&#62; &#60;!-- #image-caption { position: relative; } #image-caption p.caption { text-align:center; position: relative; bottom: 0px; left: 0px; margin: 0; padding: 5px 3%; background-color: #555; color: #fff; font-weight: bold; font-size:.75em; } --&#62;]]></description>
			<content:encoded><![CDATA[<p></p><div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Ediv.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image-caption&quot;</span>&gt;<a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Eimg.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;border: 1px solid black; float: right; margin: 0 0 10px 10px;&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;/images/imagename.jpg&quot;</span> <span style="color: #000066;">border</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;175&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;132&quot;</span> <span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><br />
<span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Ep.html"><span style="color: #000000; font-weight: bold;">&lt;p</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;caption&quot;</span><a href="http://december.com/html/4/element/%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>HTML Image Caption<span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3E%2Fp%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></a></span><br />
<br />
<span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3E%2Fdiv%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></a></span><br />
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--</span><br />
<span style="color: #009900;">#image-caption {</span><br />
<span style="color: #009900;">position: relative;</span><br />
<span style="color: #009900;">}</span><br />
<span style="color: #009900;">#image-caption p.caption {</span><br />
<span style="color: #009900;">text-align:center;</span><br />
<span style="color: #009900;">position: relative;</span><br />
<span style="color: #009900;">bottom: 0px;</span><br />
<span style="color: #009900;">left: 0px;</span><br />
<span style="color: #009900;">margin: 0;</span><br />
<span style="color: #009900;">padding: 5px 3%;</span><br />
<span style="color: #009900;">background-color: #555;</span><br />
<span style="color: #009900;">color: #fff;</span><br />
<span style="color: #009900;">font-weight: bold;</span><br />
<span style="color: #009900;">font-size:.75em;</span><br />
<span style="color: #009900;">}</span><br />
<span style="color: #009900;">--&gt;</span></span></div></div>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=535" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=535&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2010/11/10/html-image-caption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot find terminfo entry for ‘xterm-256color’</title>
		<link>http://damonparker.org/blog/2010/11/10/cannot-find-terminfo-entry-for-xterm-256color/</link>
		<comments>http://damonparker.org/blog/2010/11/10/cannot-find-terminfo-entry-for-xterm-256color/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 14:16:14 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://damonparker.org/?p=543</guid>
		<description><![CDATA[Check if you have the terminfo file installed. find /lib/terminfo /usr/share/terminfo -name &#34;*256*&#34; No results? Install ncurses-term. sudo apt-get install ncurses-term]]></description>
			<content:encoded><![CDATA[<p></p><p>Check if you have the terminfo file installed.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">find <span style="color: #66cc66;">/</span>lib<span style="color: #66cc66;">/</span>terminfo <span style="color: #66cc66;">/</span>usr<span style="color: #66cc66;">/</span>share<span style="color: #66cc66;">/</span>terminfo -name <span style="color: #ff0000;">&quot;*256*&quot;</span></div></div>
<p>No results?  Install <em>ncurses-term</em>.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo apt-get install ncurses-term</div></div>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=543" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=543&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2010/11/10/cannot-find-terminfo-entry-for-xterm-256color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging Wifi Connectivity and Routing</title>
		<link>http://damonparker.org/blog/2010/06/12/debugging-wifi-connectivity-and-routing/</link>
		<comments>http://damonparker.org/blog/2010/06/12/debugging-wifi-connectivity-and-routing/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 21:33:32 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://damonparker.org/?p=525</guid>
		<description><![CDATA[Sometimes wifi connectivity issues can be massaged a little by getting a little pushy with it&#8230; turn your internal airport card off. Leave it off for a minute then turn it back on and see if by forcing it to attempt to re-connect to your local network.  Oftentimes this will clear up minor issues. Check [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Sometimes wifi connectivity issues can be massaged a little by getting a little pushy with it&#8230; turn your internal airport card off. Leave it off for a minute then turn it back on and see if by forcing it to attempt to re-connect to your local network.  Oftentimes this will clear up minor issues.</p>
<p>Check your routing tables:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">netstat -nr</div></div>
<p>Get just the default route:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">netstat -nr <span style="color: #66cc66;">|</span> grep default</div></div>
<p>In action:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&#91;</span>root<span style="color: #66cc66;">@</span>howie ~<span style="color: #66cc66;">&#93;</span>$ netstat -nr <span style="color: #66cc66;">|</span> grep default<br />
<span style="color: #cc66cc;">5</span>:default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;192.168.1.1 &nbsp; &nbsp; &nbsp; &nbsp;UGSc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">11</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">5</span> &nbsp; &nbsp; en1</div></div>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=525" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=525&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2010/06/12/debugging-wifi-connectivity-and-routing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Sendmail for PHP mail() in OSX</title>
		<link>http://damonparker.org/blog/2010/02/25/enable-sendmail-for-php-mail-in-osx/</link>
		<comments>http://damonparker.org/blog/2010/02/25/enable-sendmail-for-php-mail-in-osx/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 22:05:41 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[sendmail]]></category>

		<guid isPermaLink="false">http://damonparker.org/blog/?p=468</guid>
		<description><![CDATA[Since this didn&#8217;t dawn on me for thirty minutes while I pursued other avenues&#8230; In /etc/hostconfig add/edit a line like: MAILSERVER=-YES- Note to self: Look for more OSX server administration clients.]]></description>
			<content:encoded><![CDATA[<p></p><p>Since this didn&#8217;t dawn on me for thirty minutes while I pursued other avenues&#8230;</p>
<p>In /etc/hostconfig add/edit a line like:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">MAILSERVER=</span>-YES-</div></div>
<p>Note to self: Look for more OSX server administration clients.  </p>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=468" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=468&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2010/02/25/enable-sendmail-for-php-mail-in-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Log Grepping</title>
		<link>http://damonparker.org/blog/2009/09/14/apache-log-grepping/</link>
		<comments>http://damonparker.org/blog/2009/09/14/apache-log-grepping/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 18:34:51 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://damonparker.org/blog/?p=368</guid>
		<description><![CDATA[Nothing beats a full stats package, but with a little grepping and a logfile and we can figure out some quick statistics. Get only hits coming from Google.com/search: grep 'google.com/search' access_log &#124; head -1 Extract only the referrer field: grep 'google.com/search' access_log &#124; head -1 &#124; awk '{print $11}' Get the search terms only: grep [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Nothing beats a full stats package, but with a little grepping and a logfile and we can figure out some quick statistics.</p>
<p><strong>Get only hits coming from Google.com/search:</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">grep <span style="color: #ff0000;">'google.com/search'</span> access_log <span style="color: #66cc66;">|</span> head -<span style="color: #cc66cc;">1</span></div></div>
<p><strong>Extract only the referrer field:</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">grep <span style="color: #ff0000;">'google.com/search'</span> access_log <span style="color: #66cc66;">|</span> head -<span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">|</span> awk <span style="color: #ff0000;">'{print $11}'</span></div></div>
<p><strong>Get the search terms only:</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">grep <span style="color: #ff0000;">'google.com/search'</span> access_log <span style="color: #66cc66;">|</span> \<br />
&nbsp; head -<span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">|</span> \<br />
&nbsp; awk <span style="color: #ff0000;">'{print $11}'</span> <span style="color: #66cc66;">|</span> \<br />
&nbsp; cut -d\? -f2 <span style="color: #66cc66;">|</span> cut -d\<span style="color: #66cc66;">&amp;</span> -f1 <span style="color: #66cc66;">|</span> \<br />
&nbsp; sed <span style="color: #ff0000;">'s/+/ /g;s/%22/&quot;/g;s/q=//'</span></div></div>
<p>Here&#8217;s a little script that puts it all together.  It finds the unique search terms, cleans out the trash, sorts them and list the top twenty five in order of descending hit count.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #0000ff;">LOG=</span><span style="color: #ff0000;">&quot;/var/logs/httpd/access_log&quot;</span><br />
grep <span style="color: #ff0000;">'google.com/search'</span> <span style="color: #0000ff;">$LOG</span> <span style="color: #66cc66;">|</span> \<br />
&nbsp; awk <span style="color: #ff0000;">'{print $11}'</span> <span style="color: #66cc66;">|</span> \<br />
&nbsp; cut -d\? -f2 <span style="color: #66cc66;">|</span> cut -d\<span style="color: #66cc66;">&amp;</span> -f1 <span style="color: #66cc66;">|</span> \<br />
&nbsp; sed <span style="color: #ff0000;">'s/+/ /g;s/%22/&quot;/g;s/q=//'</span> <span style="color: #66cc66;">|</span> \<br />
&nbsp; sed <span style="color: #ff0000;">'s/%[0-9a-fA-F][0-9a-fA-F]/ /g;s/&quot;//g'</span> <span style="color: #66cc66;">|</span> \<br />
&nbsp; grep -v <span style="color: #ff0000;">'='</span> <span style="color: #66cc66;">|</span> sort <span style="color: #66cc66;">|</span> uniq -c <span style="color: #66cc66;">|</span> sort -rn <span style="color: #66cc66;">|</span> head -<span style="color: #cc66cc;">25</span></div></div>
<p>To see them all remove the <code class="codecolorer bash default"><span class="bash"><span style="color: #66cc66;">|</span> head -<span style="color: #cc66cc;">25</span></span></code> statement at the end of the command.</p>
<p>Thanks to an article at <a href="http://www.linuxjournal.com/article/9417">Linux Journal</a> for the examples.</p>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=368" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=368&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2009/09/14/apache-log-grepping/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Find setuid root Files</title>
		<link>http://damonparker.org/blog/2009/09/10/find-setuid-root-files/</link>
		<comments>http://damonparker.org/blog/2009/09/10/find-setuid-root-files/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 04:29:20 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://damonparker.org/blog/?p=452</guid>
		<description><![CDATA[Find all setuid / setgid files owned by root:
find / -user root -type f \( -perm -4000 -o -perm -2000 \) -exec ls -ld '{}' \;

Find all setuid / setgid files owned by any user:
find / -type f \( -perm -4000 -o -perm -2000 \) -exec ls -ld '{}' \;]]></description>
			<content:encoded><![CDATA[<p></p><p>Find all setuid / setgid files owned by root:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">find <span style="color: #66cc66;">/</span> -user root -<span style="color: #000066;">type</span> f \<span style="color: #66cc66;">&#40;</span> -perm -<span style="color: #cc66cc;">4000</span> -o -perm -<span style="color: #cc66cc;">2000</span> \<span style="color: #66cc66;">&#41;</span> -<span style="color: #000066;">exec</span> ls -ld <span style="color: #ff0000;">'{}'</span> \;</div></div>
<p>Find all setuid / setgid files owned by any user:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">find <span style="color: #66cc66;">/</span> -<span style="color: #000066;">type</span> f \<span style="color: #66cc66;">&#40;</span> -perm -<span style="color: #cc66cc;">4000</span> -o -perm -<span style="color: #cc66cc;">2000</span> \<span style="color: #66cc66;">&#41;</span> -<span style="color: #000066;">exec</span> ls -ld <span style="color: #ff0000;">'{}'</span> \;</div></div>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=452" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=452&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2009/09/10/find-setuid-root-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging HTTP Headers with cURL</title>
		<link>http://damonparker.org/blog/2009/08/31/debugging-http-headers-with-curl/</link>
		<comments>http://damonparker.org/blog/2009/08/31/debugging-http-headers-with-curl/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 16:05:39 +0000</pubDate>
		<dc:creator>damonp</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://damonparker.org/blog/?p=369</guid>
		<description><![CDATA[curl -I http://damonparker.org More info on cURL]]></description>
			<content:encoded><![CDATA[<p></p><div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">curl -I http:<span style="color: #66cc66;">//</span>damonparker.org</div></div>
<p><a href="http://curl.haxx.se/docs/manpage.html">More info on cURL</a></p>
 <img src="http://damonparker.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=369" width="1" height="1" style="display: none;" /><img src="http://damonparker.org/?ak_action=api_record_view&id=369&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://damonparker.org/blog/2009/08/31/debugging-http-headers-with-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using xcache
Database Caching 71/89 queries in 0.011 seconds using xcache
Content Delivery Network via cdn.damonparker.org/q9i5a4w8/cds/dp

Served from: damonparker.org @ 2012-02-04 13:59:35 -->
