<?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>Dolbex &#187; MySQL</title>
	<atom:link href="http://www.dolbex.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dolbex.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 14 Oct 2009 14:21:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CakePHP and Encoding Problems &#8211; Solves International and Word Special Chars</title>
		<link>http://www.dolbex.com/cakephp-and-encoding-problems-solves-international-and-word-special-chars/</link>
		<comments>http://www.dolbex.com/cakephp-and-encoding-problems-solves-international-and-word-special-chars/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 11:05:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[character]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[microsoft word]]></category>
		<category><![CDATA[special chars]]></category>

		<guid isPermaLink="false">http://www.dolbex.com/?p=63</guid>
		<description><![CDATA[So, embarrassingly I have been putting up with this for years and just never could quite put a finger on how to handle it.  The situation is this: You have some sort of content management system (CMS) setup for your client that you have made homebrew (or not maybe).  You&#8217;ve painstakingly put time into security, [...]]]></description>
			<content:encoded><![CDATA[<p>So, embarrassingly I have been putting up with this for years and just never could quite put a finger on how to handle it.  The situation is this: You have some sort of content management system (CMS) setup for your client that you have made homebrew (<a href="http://www.mattfarina.com/2007/05/24/drupal-module-highlight-handy-filters-churches-and-businesses" target="_blank">or not maybe</a>).  You&#8217;ve painstakingly put time into security, format, ease of use, etc and you hand them the rains. Two hours later you get a call that they have some &#8216;weird code&#8217; on their about page. You look and you realize they have copied and pasted some special chars from Word.  What to do?</p>
<p>Maybe this is the jerk way of handling it but I always had users copy and paste from word into a flat text file, then copy and paste into the form.  Or, I would use TinyMCE in the CMS and have their Cleaner plugin handle it. Most of the time that seems to work but not always. Today, I hit the wall on this problem with CakePHP and had to figure it out. Essentially, it all comes down to page and database encoding.</p>
<p>The short explanation:<span style="color: #ff0000;"> <strong>Set everything to UTF-8 at the beginning of your project.</strong></span> The long explanation (which is just a rehash of this awesome post at <a href="http://missingfeatures.com/2008/10/23/using-utf8-in-your-cakephp-app/" target="_blank">missingfeatures.com</a>):</p>
<ol>
<li>Set your mySQL database up with UTF-8 encoding.  This includes:
<ol>
<li>The database itself</li>
<li>The tables</li>
<li>Every field <em>(watch out for this one in phpmyadmin because if you have already created your table you&#8217;ll need to specifically change the collation for all text, varchar, and char fields)</em></li>
</ol>
</li>
<li>In your layouts:
<ol>
<li>Put this at the top:<span style="color: #ff0000;"><strong>&lt;?php header(&#8217;Content-type: text/html; charset=UTF-8&#8242;); ?&gt;</strong></span><strong><em><br />
</em></strong></li>
<li>Put this in the head: <span style="color: #ff0000;"><strong>&lt;?php echo $html-&gt;charset(&#8217;utf-8&#8242;); ?&gt;</strong></span></li>
</ol>
</li>
<li>In your database configuration file (app/config/database.php):
<ol>
<li>Add this to your default database array:<strong> <span style="color: #ff0000;">&#8216;encoding&#8217; =&gt; &#8216;utf8&#8242;</span></strong></li>
</ol>
</li>
</ol>
<p>This puts everything on the same encoding plane and allows for characters like: ü ß ☠  ☮  ☯  ♠  Ω ♤ ♣ ♧  ♥ ♡  ♦ ♢ ♔   ♕   ♚  ♛  ⚜  ★  ☆ ✮  ✯  ☄  ☾ ☽ ☼  ☀  ☁  ☂  ☃ ☻ ☺ ☹   ۞ ۩</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dolbex.com/cakephp-and-encoding-problems-solves-international-and-word-special-chars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Professional GeoCoding Service</title>
		<link>http://www.dolbex.com/professional-geocoding-service/</link>
		<comments>http://www.dolbex.com/professional-geocoding-service/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 16:36:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Geocoding]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[USC]]></category>

		<guid isPermaLink="false">http://www.dolbex.com/?p=15</guid>
		<description><![CDATA[If you have more than a couple thousand records you want to geocode all at once we found a great service from USC&#8217;s GIS department that allows you to geocode records in an Access database.  It&#8217;s not terribly fast but we were able to geocode nearly 200,000 records in a couple of days. Just make [...]]]></description>
			<content:encoded><![CDATA[<p>If you have more than a couple thousand records you want to geocode all at once we found a great service from USC&#8217;s GIS department that allows you to geocode records in an Access database.  It&#8217;s not terribly fast but we were able to geocode nearly 200,000 records in a couple of days. Just make sure your computer isn&#8217;t set to go to sleep an hour after you step away from the computer&#8230;. :/</p>
<p><a href="https://webgis.usc.edu/Default.aspx">https://webgis.usc.edu/Default.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dolbex.com/professional-geocoding-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting from multiple tables in mySQL</title>
		<link>http://www.dolbex.com/deleting-from-multiple-tables-in-mysql/</link>
		<comments>http://www.dolbex.com/deleting-from-multiple-tables-in-mysql/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 16:31:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[deleting]]></category>
		<category><![CDATA[queries]]></category>

		<guid isPermaLink="false">http://www.dolbex.com/?p=13</guid>
		<description><![CDATA[DELETE users.*, profiles.*
FROM users u, profiles prof
WHERE u.id = prof.user_id
AND u.created &#60; '2009-01-01'
]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container sql twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">DELETE</span> users<span style="color: #66cc66;">.*,</span> profiles<span style="color: #66cc66;">.*</span><br />
<span style="color: #993333; font-weight: bold;">FROM</span> users u<span style="color: #66cc66;">,</span> profiles prof<br />
<span style="color: #993333; font-weight: bold;">WHERE</span> u<span style="color: #66cc66;">.</span>id <span style="color: #66cc66;">=</span> prof<span style="color: #66cc66;">.</span>user_id<br />
<span style="color: #993333; font-weight: bold;">AND</span> u<span style="color: #66cc66;">.</span>created <span style="color: #66cc66;">&lt;</span> <span style="color: #ff0000;">'2009-01-01'</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.dolbex.com/deleting-from-multiple-tables-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding and Clearing Orphans</title>
		<link>http://www.dolbex.com/finding-and-clearing-orphans/</link>
		<comments>http://www.dolbex.com/finding-and-clearing-orphans/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 15:06:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[orphans]]></category>

		<guid isPermaLink="false">http://www.dolbex.com/?p=9</guid>
		<description><![CDATA[DELETE orphan_table FROM orphan_table
LEFT JOIN user_table
ON orphan_table.user_id = user_table.id
WHERE user_table.id IS NULL;
]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container sql twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">DELETE</span> orphan_table <span style="color: #993333; font-weight: bold;">FROM</span> orphan_table<br />
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> user_table<br />
<span style="color: #993333; font-weight: bold;">ON</span> orphan_table<span style="color: #66cc66;">.</span>user_id <span style="color: #66cc66;">=</span> user_table<span style="color: #66cc66;">.</span>id<br />
<span style="color: #993333; font-weight: bold;">WHERE</span> user_table<span style="color: #66cc66;">.</span>id <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span>;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.dolbex.com/finding-and-clearing-orphans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
