<?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>Trent Richardson</title>
	<atom:link href="http://trentrichardson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://trentrichardson.com</link>
	<description>practical web design &#38; development</description>
	<lastBuildDate>Sat, 13 Mar 2010 13:04:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fetch Ideas &#8211; Another Web Dev&#8217;s Resource</title>
		<link>http://trentrichardson.com/2010/03/09/fetch-ideas-web-resource/</link>
		<comments>http://trentrichardson.com/2010/03/09/fetch-ideas-web-resource/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 13:00:21 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[clientside]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[serverside]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=541</guid>
		<description><![CDATA[
As if there aren&#8217;t enough web galleries out there I&#8217;m adding one more,  FetchIdeas.com.  This is a site which I have created over the past couple months, with a different approach than other galleries.  My aim is to create better organization, publish only useful resources, and most of all provide a great [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2010/02/17/im-now-on-twitter/' rel='bookmark' title='Permanent Link: I&#8217;m Now On Twitter!'>I&#8217;m Now On Twitter!</a></li>
<li><a href='http://trentrichardson.com/2006/12/02/css-bubble-tooltips/' rel='bookmark' title='Permanent Link: CSS Bubble Tooltips'>CSS Bubble Tooltips</a></li>
<li><a href='http://trentrichardson.com/2009/06/18/7-lucky-tips-for-mobile-development/' rel='bookmark' title='Permanent Link: 7 Lucky Tips for Mobile Development'>7 Lucky Tips for Mobile Development</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://fetchideas.com"><img src="http://trentrichardson.com/wp-content/uploads/2010/03/fetchideaslogo.png" alt="Fetch Ideas - A Web Dev&#039;s Resource" title="fetchideaslogo" width="209" height="80" class="alignleft size-full wp-image-542" /></a>
<p>As if there aren&#8217;t enough web galleries out there I&#8217;m adding one more,  <a href="http://fetchideas.com/">FetchIdeas.com</a>.  This is a site which I have created over the past couple months, with a different approach than other galleries.  My aim is to create better organization, publish only useful resources, and most of all provide a great place to Fetch Ideas!</p>
<p>I&#8217;ve categorized everything in design, graphics and fonts, clientside (css, javascript, etc..), and serverside (php, python, mysql, etc..).  The categorization alone seems a bit different than most sites.  The site is now stable but I have many plans for it in the coming months, so don&#8217;t be shy if you notice something wrong, want to suggest something, or anything else.  Do you have any resources to suggest?</p>
<p>Also don&#8217;t for get, you can <a href="http://twitter.com/fetchideas">follow FetchIdeas.com on Twitter</a>!</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2010/02/17/im-now-on-twitter/' rel='bookmark' title='Permanent Link: I&#8217;m Now On Twitter!'>I&#8217;m Now On Twitter!</a></li>
<li><a href='http://trentrichardson.com/2006/12/02/css-bubble-tooltips/' rel='bookmark' title='Permanent Link: CSS Bubble Tooltips'>CSS Bubble Tooltips</a></li>
<li><a href='http://trentrichardson.com/2009/06/18/7-lucky-tips-for-mobile-development/' rel='bookmark' title='Permanent Link: 7 Lucky Tips for Mobile Development'>7 Lucky Tips for Mobile Development</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/03/09/fetch-ideas-web-resource/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handling TimeZones in CakePHP</title>
		<link>http://trentrichardson.com/2010/03/05/handling-timezones-in-cakephp/</link>
		<comments>http://trentrichardson.com/2010/03/05/handling-timezones-in-cakephp/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 13:15:02 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[timezone]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=526</guid>
		<description><![CDATA[
The web is a global resource for anything, anywhere, any timezone.  But often times we are careless in consideration for people in other areas of the world.  The different timezones offset people&#8217;s schedules from one area to the next.  When handling user profiles (or anything for that matter) where date and time [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2009/03/31/handling-php-form-arrays-with-jquery/' rel='bookmark' title='Permanent Link: Handling PHP Form Arrays with jQuery'>Handling PHP Form Arrays with jQuery</a></li>
<li><a href='http://trentrichardson.com/2010/01/31/cakephp-postgresql-and-regex/' rel='bookmark' title='Permanent Link: CakePHP, PostgreSQL, and Regex'>CakePHP, PostgreSQL, and Regex</a></li>
<li><a href='http://trentrichardson.com/2010/02/03/adding-postgresql-regex-support-in-cakephp/' rel='bookmark' title='Permanent Link: Adding PostgreSQL Regex Support in CakePHP'>Adding PostgreSQL Regex Support in CakePHP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://trentrichardson.com/wp-content/uploads/2010/03/timezone.png" alt="Timezones with CakePHP" title="timezone" width="128" height="128" class="alignright size-full wp-image-530" /></p>
<p>The web is a global resource for anything, anywhere, any timezone.  But often times we are careless in consideration for people in other areas of the world.  The different timezones offset people&#8217;s schedules from one area to the next.  When handling user profiles (or anything for that matter) where date and time is involved we can do a little magic with our CakePHP app to make things a little more convenient for our users.  How do we handle this you ask?</p>
<p>First lets say when a user logs in to their profile they can click to edit the profile, selects his/her timezone, and clicks save. Relative to GMT we can calculate offsets of each timezone, where GMT would = 0.  So for instance Eastern Timezone for New York, US would be -5 since its 5 ours BEHIND GMT.  So lets start by generating a dropdown list with cake with all the different timezones, then save this list to the users profile.  If you are using Auth with CakePHP, you will likely have a users table, and we&#8217;ll add a decimal field called &#8220;timezone&#8221; to that table.  Fortunately there is a helper to assist us with this dropdown in the bakery, <a href="http://bakery.cakephp.org/articles/view/updated-timezone-helper">Timezone Helper</a>.  By taking a look at the source you&#8217;ll notice all the labels associated with an offset &#8220;-5.0&#8243; or &#8220;+3.0&#8243;.  Also look a little closer and you might notice a few have actual decimal (Kabul is +4.5).  So first things first, go ahead and install that Helper as those instructions say.  Add it to your Edit view for users to edit their profile. Once included you just add the drop down to your form with:</p>
<pre><code class="php">
echo $timezone->select('timezone');
</code></pre>
<p>Now each user should have a timezone attached to their profile.  Now the trick to timezones is that no matter what the timezone of our server is, we just want to convert it to display to the user in that user&#8217;s preferred timezone.  On the reverse side, if a user enters a datetime, we convert it back to the timezone of the server.</p>
<p>Lets start our with the user viewing a date from the server, in our view we want to convert it to the user&#8217;s preferred timezone set to their profile (which should now be stored in their session, I&#8217;ll demonstrate with Auth)</p>
<pre><code class="php">
$time->format('F j, Y g:i:s a', $mydate, null, $session->read('Auth.User.timezone'));
</code></pre>
<p>Using the Time helper in CakePHP, the format function accepts a fourth parameter which indicates the timezone, which is extremely helpful.  So this is all you need to do to display a time from the server to a user.</p>
<p>Next lets say the user is about to edit a field from the server in a form.  First we need to select the existing data from the database, we&#8217;ll convert it to the user&#8217;s timezone, and place it in an input field to be edited.  Then once the user saves the data we&#8217;ll simply convert it back to the server&#8217;s timezone.  (There a bunch of &#8220;one liners&#8221; in doing all of these tasks).  So if you have your Time helper in your controller when you get the data from the database, go ahead and convert it to the new timezone just like we did before:</p>
<pre><code class="php">
$data['Model']['mydate'] = $time->format('Y-n-d H:i:sP', $data['Model']['mydate'], null, $this->Auth->user('timezone'));
</code></pre>
<p>Now in your view for the form there are a few different scenarios.  1) You use Cake&#8217;s default inputs for editing date times, with the 6 dropdowns, or 2) You use a plain input and use a date/time picker of some sort.  Lets first handle the first scenario, Cakes default 6 input datetime.  The data has been submitted, validated and we&#8217;re about to place it back in the database, we need to convert it back to server timezone.  But wait! the form field is broken down into an array of six elements: year, month, day, hour, minute, meridian.  Well we can create a nice little function that will convert this array into a datetime, and pass it our timezone: </p>
<pre><code class="php">
function dateTimeArrayToServerTZString($dt, $tz=0){
	$tz = (floatval($tz) >= 0)? '+'. number_format(floatval($tz),2,':','') : number_format(floatval($tz),2,':','');
	$dt['min'] = str_pad($dt['min'], 2, "0", STR_PAD_LEFT);

	$loc = $dt['year'] .'-'. $dt['month'] .'-'. $dt['day'] .' '. $dt['hour'] .':'. $dt['min'] .' '. $dt['meridian'] .' '. $tz;

	$datetime = new DateTime($loc);
	$datetime->setTimezone(new DateTimeZone(date('e', time())));

	return $datetime->format('Y-n-d H:i:sP');
}
</code></pre>
<p>Now right before I insert my data into the database I just need to call this function on that datetime array:</p>
<pre><code class="php">
$this->data['Model']['mydate'] = dateTimeArrayToServerTZString($this->data['Model']['mydate'], $this->Auth->user('timezone'));
</code></pre>
<p>Now $this->data['Model']['mydate'] will be a string, and cake still knows how to handle that just fine.  Now for the second scenerio, a user submitting a string.  This isn&#8217;t too hard at all, we just use our time helper and convert that puppy back to the server time.</p>
<pre><code class="php">
$this->data['Model']['mydate'] = $time->format('Y-n-d H:i:sP', $this->data['Model']['mydate'], null, -5);
</code></pre>
<p>Ok, so I&#8217;ve hardcoded in the timezone to -5 (Eastern Timezone), what if I want this to be dynamic to where ever my server is? Well the Time helper has a function which isn&#8217;t mentioned in the book called serverOffset(), which will return a number of the offset.  If you&#8217;re not using the helper and just want to get the timezone of the server its a simple one-liner:</p>
<pre><code class="php">
date('Z', time())
</code></pre>
<p>Thats all there is to handling timezones in your cakePHP site, or any site for that matter.  Just keep in mind as you go to convert any times for the user&#8217;s pleasure.  You have any tips or alternatives?</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2009/03/31/handling-php-form-arrays-with-jquery/' rel='bookmark' title='Permanent Link: Handling PHP Form Arrays with jQuery'>Handling PHP Form Arrays with jQuery</a></li>
<li><a href='http://trentrichardson.com/2010/01/31/cakephp-postgresql-and-regex/' rel='bookmark' title='Permanent Link: CakePHP, PostgreSQL, and Regex'>CakePHP, PostgreSQL, and Regex</a></li>
<li><a href='http://trentrichardson.com/2010/02/03/adding-postgresql-regex-support-in-cakephp/' rel='bookmark' title='Permanent Link: Adding PostgreSQL Regex Support in CakePHP'>Adding PostgreSQL Regex Support in CakePHP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/03/05/handling-timezones-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I&#8217;ve Nearly Doubled Website Traffic</title>
		<link>http://trentrichardson.com/2010/03/03/doubled-website-traffic/</link>
		<comments>http://trentrichardson.com/2010/03/03/doubled-website-traffic/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 13:46:35 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[redesign]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=523</guid>
		<description><![CDATA[Over the course of the past month I&#8217;ve been doing a bit of work on my blog, everything from performance, to seo.  I&#8217;ve noticed a pretty good jump in my visitors too.  Nearly twice as many!  I thought I&#8217;d share a few of the enhancements I&#8217;ve made.  This is of course [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2009/02/21/add-the-yoyo-effect-to-your-wordpress-sidebar/' rel='bookmark' title='Permanent Link: Add the YoYo effect to your Wordpress Sidebar'>Add the YoYo effect to your Wordpress Sidebar</a></li>
<li><a href='http://trentrichardson.com/2010/02/23/reading-a-book/' rel='bookmark' title='Permanent Link: Reading a Book'>Reading a Book</a></li>
<li><a href='http://trentrichardson.com/2009/04/01/possibly-the-best-svn-plugin-for-gedit/' rel='bookmark' title='Permanent Link: Possibly the Best SVN Plugin for gEdit'>Possibly the Best SVN Plugin for gEdit</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Over the course of the past month I&#8217;ve been doing a bit of work on my blog, everything from performance, to seo.  I&#8217;ve noticed a pretty good jump in my visitors too.  Nearly twice as many!  I thought I&#8217;d share a few of the enhancements I&#8217;ve made.  This is of course a <a href="http://wordpress.org/">WordPress</a> blog, so of course all the changes are for WordPress.</p>
<ol>
<li><a href="http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/" title="Yet Another Related Posts Plugin">Yet Another Related Posts Plugin</a></li>
<li><a href="http://wordpress.org/extend/plugins/wp-cache/" title="wp-cache">wp-cache</a></li>
<li><a href="http://wordpress.org/extend/plugins/sociable/" title="Sociable">Sociable</a></li>
<li><a href="http://wordpress.org/extend/plugins/bird-feeder/" title="Bird Feeder">Bird Feeder</a></li>
<li><a href="http://wordpress.org/extend/plugins/all-in-one-seo-pack/" title="All in One SEO Pack">All in One SEO Pack</a></li>
<li><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/">Google XML Sitemaps</a></li>
<li>Resorted to a more CSS based design with fewer images to load</li>
<li>And a change of servers, so hopefully the site will load a bit faster</li>
</ol>
<p>Most of these are simply plugins, so they are dirt simple changes.  Google Sitemap Generator took a little thought in tweaking its configuration, and same goes with the others as well so they fit my needs.  I also am trying to keep the site clean looking, and not become cluttered, which forces me to be careful selecting plugins which may harm the visual aspect of the site.  I&#8217;ve also considered a translation plugin.  Does anyone have any experience or suggestions on these? Or whether or not it would help?  Hope these tips help you as well as it did me! </p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2009/02/21/add-the-yoyo-effect-to-your-wordpress-sidebar/' rel='bookmark' title='Permanent Link: Add the YoYo effect to your Wordpress Sidebar'>Add the YoYo effect to your Wordpress Sidebar</a></li>
<li><a href='http://trentrichardson.com/2010/02/23/reading-a-book/' rel='bookmark' title='Permanent Link: Reading a Book'>Reading a Book</a></li>
<li><a href='http://trentrichardson.com/2009/04/01/possibly-the-best-svn-plugin-for-gedit/' rel='bookmark' title='Permanent Link: Possibly the Best SVN Plugin for gEdit'>Possibly the Best SVN Plugin for gEdit</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/03/03/doubled-website-traffic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Few Changes Under the Hood</title>
		<link>http://trentrichardson.com/2010/02/27/a-fewchanges-under-the-hood/</link>
		<comments>http://trentrichardson.com/2010/02/27/a-fewchanges-under-the-hood/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 03:04:07 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[optimizations]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=521</guid>
		<description><![CDATA[I&#8217;ve made a few changes to the blog lately, under the hood and visually over the past month.  If all works out I should have much to talk about in the coming weeks about my findings.  I have noticed positive increases thus far, so that is good news.  Keep tuned, find out [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2010/03/03/doubled-website-traffic/' rel='bookmark' title='Permanent Link: How I&#8217;ve Nearly Doubled Website Traffic'>How I&#8217;ve Nearly Doubled Website Traffic</a></li>
<li><a href='http://trentrichardson.com/2008/10/30/blog-rush-no-more/' rel='bookmark' title='Permanent Link: Blog Rush No More'>Blog Rush No More</a></li>
<li><a href='http://trentrichardson.com/2008/10/03/linux-evolution-before-our-eyes/' rel='bookmark' title='Permanent Link: Linux Evolution Before Our Eyes'>Linux Evolution Before Our Eyes</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a few changes to the blog lately, under the hood and visually over the past month.  If all works out I should have much to talk about in the coming weeks about my findings.  I have noticed positive increases thus far, so that is good news.  Keep tuned, find out if these changes could help you!</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2010/03/03/doubled-website-traffic/' rel='bookmark' title='Permanent Link: How I&#8217;ve Nearly Doubled Website Traffic'>How I&#8217;ve Nearly Doubled Website Traffic</a></li>
<li><a href='http://trentrichardson.com/2008/10/30/blog-rush-no-more/' rel='bookmark' title='Permanent Link: Blog Rush No More'>Blog Rush No More</a></li>
<li><a href='http://trentrichardson.com/2008/10/03/linux-evolution-before-our-eyes/' rel='bookmark' title='Permanent Link: Linux Evolution Before Our Eyes'>Linux Evolution Before Our Eyes</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/02/27/a-fewchanges-under-the-hood/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Go at Design &#8211; Waccamaw Floor Covering</title>
		<link>http://trentrichardson.com/2010/02/26/a-go-at-design-waccamaw-floor-covering/</link>
		<comments>http://trentrichardson.com/2010/02/26/a-go-at-design-waccamaw-floor-covering/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 17:21:46 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=512</guid>
		<description><![CDATA[
I had an opportunity recently to get back to a little design work with a local flooring company, Waccamaw Floor Covering.  I had fun with it but I also tried to integrate a few new things I&#8217;ve not done in the past, everything from seo, flowplayer, to google maps (street view).  In the [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2007/07/16/jquery-impromptu/' rel='bookmark' title='Permanent Link: jQuery Impromptu'>jQuery Impromptu</a></li>
<li><a href='http://trentrichardson.com/2008/05/01/land-in-bucksville-oaks-sc/' rel='bookmark' title='Permanent Link: Land In Bucksville Oaks &#8211; Conway, SC'>Land In Bucksville Oaks &#8211; Conway, SC</a></li>
<li><a href='http://trentrichardson.com/2009/02/26/to-share-or-to-buy/' rel='bookmark' title='Permanent Link: To Share or to Buy'>To Share or to Buy</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://trentrichardson.com/wp-content/uploads/2010/02/wfc-Screenshot.jpg" alt="Waccamaw Floor Covering" title="wfc-Screenshot" width="580" height="266" class="alignnone size-full wp-image-514" /></p>
<p>I had an opportunity recently to get back to a little design work with a local flooring company, <a href="http://waccamawfloorcovering.com">Waccamaw Floor Covering</a>.  I had fun with it but I also tried to integrate a few new things I&#8217;ve not done in the past, everything from seo, flowplayer, to google maps (street view).  In the end I think it turned out pretty well, even though we&#8217;re still working on the copy.  The <a href="http://waccamawfloorcovering.com/directions">directions page</a> included maps, street view, and address, since it is a little difficult to spot the store in person.  As always feedback is welcome here!</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2007/07/16/jquery-impromptu/' rel='bookmark' title='Permanent Link: jQuery Impromptu'>jQuery Impromptu</a></li>
<li><a href='http://trentrichardson.com/2008/05/01/land-in-bucksville-oaks-sc/' rel='bookmark' title='Permanent Link: Land In Bucksville Oaks &#8211; Conway, SC'>Land In Bucksville Oaks &#8211; Conway, SC</a></li>
<li><a href='http://trentrichardson.com/2009/02/26/to-share-or-to-buy/' rel='bookmark' title='Permanent Link: To Share or to Buy'>To Share or to Buy</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/02/26/a-go-at-design-waccamaw-floor-covering/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Select Substring Using RegEx in PostgreSQL</title>
		<link>http://trentrichardson.com/2010/02/24/select-substring-using-regex-in-postgresql/</link>
		<comments>http://trentrichardson.com/2010/02/24/select-substring-using-regex-in-postgresql/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 13:06:24 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=505</guid>
		<description><![CDATA[I thought of another handy scenario for using regular expressions in Postgres.  This time not within the conditions, but in the returned results. Lets say for instance you have a column with URL, (maybe blog comments or something) and you would like to get a list of all the domain names, not the full [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2008/10/21/incorporating-regex-into-orms-and-database-abstractions/' rel='bookmark' title='Permanent Link: Incorporating Regex into ORM&#8217;s and Database Abstractions'>Incorporating Regex into ORM&#8217;s and Database Abstractions</a></li>
<li><a href='http://trentrichardson.com/2008/10/23/exploring-various-sql-regex-syntax/' rel='bookmark' title='Permanent Link: Exploring Various SQL RegEx Syntax'>Exploring Various SQL RegEx Syntax</a></li>
<li><a href='http://trentrichardson.com/2007/12/27/are-you-using-regular-expressions-within-sql/' rel='bookmark' title='Permanent Link: Are You Using Regular Expressions Within SQL?'>Are You Using Regular Expressions Within SQL?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I thought of another handy scenario for using regular expressions in Postgres.  This time not within the conditions, but in the returned results. Lets say for instance you have a column with URL, (maybe blog comments or something) and you would like to get a list of all the domain names, not the full paths trailing it nor the http://, how would you do that?  Without regular expressions you would be forced to use a combination of various string functions to look for the domain name, and you will also aquire a headache free of charge.  However with a simple regular expression you could do something like this:</p>
<pre><code class="mysql">
select SUBSTRING(url FROM 'http://([^/]*).*') as domainname from my table
</code></pre>
<p>Pretty simple you must admit.  Ok, so that is pretty straight forward.  Now lets say we wanted to scan a column for any phone numbers.  I&#8217;ll keep the phone number regular expression simple for this example.  The phone number is 10 numbers, with only a possible dash after the third and sixth numbers.</p>
<pre><code class="mysql">
select SUBSTRING(colname FROM '([0-9]{3}\-?[0-9]{3}\-?[0-9]{4})') as numstr from tablename
</code></pre>
<p>Ok, now one final scenario.  We are still looking for a phone number, but there could be more than one per column.  We would like to find them all!  Well, there&#8217;s a regex for that.</p>
<pre><code class="mysql">
select regexp_matches(colname, '([0-9]{3}\-?[0-9]{3}\-?[0-9]{4})', 'g') as numstr from tablename
</code></pre>
<p>Now you can see we&#8217;ve changed up our substring function to regexp_matches, which will give us the ability to search for all matches.  I&#8217;m sure most everyone is familar with a regular expression matching function so this is nothing new.  You can find more information on using these functions in the <a href="http://www.postgresql.org/docs/current/static/functions-matching.html">Postgres Docs</a>.  Hope you&#8217;ve enjoyed more Regular Expressions with Postgres!</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2008/10/21/incorporating-regex-into-orms-and-database-abstractions/' rel='bookmark' title='Permanent Link: Incorporating Regex into ORM&#8217;s and Database Abstractions'>Incorporating Regex into ORM&#8217;s and Database Abstractions</a></li>
<li><a href='http://trentrichardson.com/2008/10/23/exploring-various-sql-regex-syntax/' rel='bookmark' title='Permanent Link: Exploring Various SQL RegEx Syntax'>Exploring Various SQL RegEx Syntax</a></li>
<li><a href='http://trentrichardson.com/2007/12/27/are-you-using-regular-expressions-within-sql/' rel='bookmark' title='Permanent Link: Are You Using Regular Expressions Within SQL?'>Are You Using Regular Expressions Within SQL?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/02/24/select-substring-using-regex-in-postgresql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reading a Book</title>
		<link>http://trentrichardson.com/2010/02/23/reading-a-book/</link>
		<comments>http://trentrichardson.com/2010/02/23/reading-a-book/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 12:52:44 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=503</guid>
		<description><![CDATA[Never thought I would say this since I&#8217;m long out of college, but I am in fact reading a book.  (Hence why I&#8217;ve been quiet here on the blog the last few days)  I purchased the The Smashing Book.  So far it has been very educational.  It is broken up into [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Never thought I would say this since I&#8217;m long out of college, but I am in fact reading a book.  (Hence why I&#8217;ve been quiet here on the blog the last few days)  I purchased the <a href="http://www.smashingmagazine.com/2009/12/03/smashing-book-its-out-now/">The Smashing Book</a>.  So far it has been very educational.  It is broken up into several really useful topics, although I&#8217;ve only made it though the first few.  After just two chapters I felt like I had my money&#8217;s worth, now everything is just an extra bonus!  Any who, I&#8217;ll be back to posting regularly in a day or two!</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/02/23/reading-a-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gedit PHP Completion and Collaboration</title>
		<link>http://trentrichardson.com/2010/02/19/gedit-php-completion-collaboratio/</link>
		<comments>http://trentrichardson.com/2010/02/19/gedit-php-completion-collaboratio/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 12:50:24 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=498</guid>
		<description><![CDATA[If you&#8217;re a gEdit fan like I am you will be excited to see these plugins by Jesse van den Kieboom.  First off a php completion plugin.  This is something I&#8217;ve been hoping to find for quite some time.  You can find it over at GitHub.  The second thing is Collaboration. [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2009/04/01/possibly-the-best-svn-plugin-for-gedit/' rel='bookmark' title='Permanent Link: Possibly the Best SVN Plugin for gEdit'>Possibly the Best SVN Plugin for gEdit</a></li>
<li><a href='http://trentrichardson.com/2008/11/18/code-editor-fantasies/' rel='bookmark' title='Permanent Link: Code Editor Fantasies'>Code Editor Fantasies</a></li>
<li><a href='http://trentrichardson.com/2009/11/02/handy-gedit-snippet-how-to-comment/' rel='bookmark' title='Permanent Link: Handy gEdit Snippet How To: Comment'>Handy gEdit Snippet How To: Comment</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re a gEdit fan like I am you will be excited to see these plugins by <a href="http://blogs.gnome.org/jessevdk/">Jesse van den Kieboom</a>.  First off a php completion plugin.  This is something I&#8217;ve been hoping to find for quite some time.  You can find it over at <a href="http://github.com/jessevdk/gedit-php-completion">GitHub</a>.  The second thing is <a href="http://blogs.gnome.org/jessevdk/2010/02/15/gedit-gobby-collaboration/">Collaboration</a>.  While I haven&#8217;t played with this personally I watched the video and it looks pretty sweet:</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/rXzI2dInXKI&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/rXzI2dInXKI&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p>
<p>I believe <a href="http://www.panic.com/coda/">Coda</a> already has this feature, so its nice to see it show up in gEdit, which has become my editor of choice lately.</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2009/04/01/possibly-the-best-svn-plugin-for-gedit/' rel='bookmark' title='Permanent Link: Possibly the Best SVN Plugin for gEdit'>Possibly the Best SVN Plugin for gEdit</a></li>
<li><a href='http://trentrichardson.com/2008/11/18/code-editor-fantasies/' rel='bookmark' title='Permanent Link: Code Editor Fantasies'>Code Editor Fantasies</a></li>
<li><a href='http://trentrichardson.com/2009/11/02/handy-gedit-snippet-how-to-comment/' rel='bookmark' title='Permanent Link: Handy gEdit Snippet How To: Comment'>Handy gEdit Snippet How To: Comment</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/02/19/gedit-php-completion-collaboratio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m Now On Twitter!</title>
		<link>http://trentrichardson.com/2010/02/17/im-now-on-twitter/</link>
		<comments>http://trentrichardson.com/2010/02/17/im-now-on-twitter/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 12:45:08 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=492</guid>
		<description><![CDATA[
It took me long enough, but I&#8217;m now on Twitter!  I actually had an account set up several months ago but never logged in.  I decided it was time.  My username is practicalweb.  While I may not post every event in life, I will try to keep it up to date [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2010/03/09/fetch-ideas-web-resource/' rel='bookmark' title='Permanent Link: Fetch Ideas &#8211; Another Web Dev&#8217;s Resource'>Fetch Ideas &#8211; Another Web Dev&#8217;s Resource</a></li>
<li><a href='http://trentrichardson.com/2010/02/23/reading-a-book/' rel='bookmark' title='Permanent Link: Reading a Book'>Reading a Book</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://twitter.com/practicalweb"><img src="http://trentrichardson.com/wp-content/uploads/2010/02/twitter.png" alt="Follow Me on Twitter" title="twitter" width="128" height="128" class="alignleft size-full wp-image-493" /></a>
<p>It took me long enough, but I&#8217;m now on <a href="http://twitter.com/practicalweb">Twitter</a>!  I actually had an account set up several months ago but never logged in.  I decided it was time.  My username is <a href="http://twitter.com/practicalweb">practicalweb</a>.  While I may not post every event in life, I will try to keep it up to date with the blog and anything else I decide is worth sharing but not worth an entire blog post.  Anyway, Follow Me if you like!</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2010/03/09/fetch-ideas-web-resource/' rel='bookmark' title='Permanent Link: Fetch Ideas &#8211; Another Web Dev&#8217;s Resource'>Fetch Ideas &#8211; Another Web Dev&#8217;s Resource</a></li>
<li><a href='http://trentrichardson.com/2010/02/23/reading-a-book/' rel='bookmark' title='Permanent Link: Reading a Book'>Reading a Book</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/02/17/im-now-on-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Impromptu 3.0 is Here</title>
		<link>http://trentrichardson.com/2010/02/16/jquery-impromptu-3-0-is-here/</link>
		<comments>http://trentrichardson.com/2010/02/16/jquery-impromptu-3-0-is-here/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 12:52:22 +0000</pubDate>
		<dc:creator>trent</dc:creator>
				<category><![CDATA[Impromptu]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://trentrichardson.com/?p=487</guid>
		<description><![CDATA[Finally, Impromptu 3.0 has made it!  It features two changes really.  One big and one small.  The small addition was an option for classes.  So you can now add extra classes to an individual prompt to customize the styles without needing an entirely new theme.  Here&#8217;s the syntax:

$.prompt('text here..', { [...]


Related posts:<ol><li><a href='http://trentrichardson.com/2009/12/18/jquery-impromptu-2-8-a-couple-tweaks/' rel='bookmark' title='Permanent Link: jQuery Impromptu 2.8 &#8211; A Couple Tweaks'>jQuery Impromptu 2.8 &#8211; A Couple Tweaks</a></li>
<li><a href='http://trentrichardson.com/2007/11/09/any-requests-for-impromptu-11/' rel='bookmark' title='Permanent Link: Any Requests for Impromptu 1.1?'>Any Requests for Impromptu 1.1?</a></li>
<li><a href='http://trentrichardson.com/2009/05/27/welcome-jquery-impromptu-26/' rel='bookmark' title='Permanent Link: Welcome jQuery Impromptu 2.6'>Welcome jQuery Impromptu 2.6</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Finally, <a href="http://trentrichardson.com/Impromptu">Impromptu 3.0</a> has made it!  It features two changes really.  One big and one small.  The small addition was an option for classes.  So you can now add extra classes to an individual prompt to customize the styles without needing an entirely new theme.  Here&#8217;s the syntax:</p>
<pre><code class="js">
$.prompt('text here..', { classes: 'class1 myclass2 darkfade' });
</code></pre>
<p>The classes are added to the parent container which holds the fade and the prompt, so they have access to both.</p>
<p>Now for the big new feature.  You can now call a prompt from a selector!</p>
<pre><code class="js">
$('#myselector').prompt(options);

// or like this
$('&lt;span&gt;some html&lt;/span&gt;').prompt(options);
</code></pre>
<p>There is one extra option for using this technique, withDataAndEvents.  This comes from using jQuery&#8217;s clone method.  Head on over to the docs for more information on the <a href="http://api.jquery.com/clone/" target="_blank">clone method</a>.  It defaults to false.  But using it might  look something like this: </p>
<pre><code class="js">
$('#myselector').prompt({ withDataAndEvents: true });
</code></pre>
<p>This is entirely new to Impromptu and to me.  So if something acts funny with it please don&#8217;t hesitate to post here.  Enjoy!</p>


<p>Related posts:<ol><li><a href='http://trentrichardson.com/2009/12/18/jquery-impromptu-2-8-a-couple-tweaks/' rel='bookmark' title='Permanent Link: jQuery Impromptu 2.8 &#8211; A Couple Tweaks'>jQuery Impromptu 2.8 &#8211; A Couple Tweaks</a></li>
<li><a href='http://trentrichardson.com/2007/11/09/any-requests-for-impromptu-11/' rel='bookmark' title='Permanent Link: Any Requests for Impromptu 1.1?'>Any Requests for Impromptu 1.1?</a></li>
<li><a href='http://trentrichardson.com/2009/05/27/welcome-jquery-impromptu-26/' rel='bookmark' title='Permanent Link: Welcome jQuery Impromptu 2.6'>Welcome jQuery Impromptu 2.6</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://trentrichardson.com/2010/02/16/jquery-impromptu-3-0-is-here/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.767 seconds -->
<!-- Cached page served by WP-Cache -->
